diff --git a/realtime/node_modules/.bin/express b/realtime/node_modules/.bin/express deleted file mode 100644 index cad5a1ef..00000000 --- a/realtime/node_modules/.bin/express +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=`dirname "$0"` - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../express/bin/express" "$@" - ret=$? -else - node "$basedir/../express/bin/express" "$@" - ret=$? -fi -exit $ret diff --git a/realtime/node_modules/.bin/express.cmd b/realtime/node_modules/.bin/express.cmd deleted file mode 100644 index a3ce07c4..00000000 --- a/realtime/node_modules/.bin/express.cmd +++ /dev/null @@ -1,6 +0,0 @@ -:: Created by npm, please don't edit manually. -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\express\bin\express" %* -) ELSE ( - node "%~dp0\..\express\bin\express" %* -) \ No newline at end of file diff --git a/realtime/node_modules/express/.npmignore b/realtime/node_modules/express/.npmignore deleted file mode 100644 index caf574de..00000000 --- a/realtime/node_modules/express/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -.git* -docs/ -examples/ -support/ -test/ -testing.js -.DS_Store -coverage.html -lib-cov diff --git a/realtime/node_modules/express/.travis.yml b/realtime/node_modules/express/.travis.yml deleted file mode 100644 index a12e3f0f..00000000 --- a/realtime/node_modules/express/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" \ No newline at end of file diff --git a/realtime/node_modules/express/History.md b/realtime/node_modules/express/History.md deleted file mode 100644 index 9d53bef4..00000000 --- a/realtime/node_modules/express/History.md +++ /dev/null @@ -1,1274 +0,0 @@ -4.0.0 / -================== - - * remove: - - express(1) - moved to [express-generator](https://github.com/expressjs/generator) - - `req.accepted*` - use `req.accepts*()` instead - - `app.configure` - use logic in your own app code - * change: - - `req.accepts*` -> `req.accepts*s` - i.e. `req.acceptsEncoding` -> `req.acceptsEncodings` - - `req.params` is now an object instead of an array - - `json spaces` no longer enabled by default in development - * refactor: - - `req.accepts*` with [accepts](https://github.com/expressjs/accepts) - - `req.is` with [type-is](https://github.com/expressjs/type-is) - -3.4.8 / 2014-01-13 -================== - - * prevent incorrect automatic OPTIONS responses #1868 @dpatti - * update binary and examples for jade 1.0 #1876 @yossi, #1877 @reqshark, #1892 @matheusazzi - * throw 400 in case of malformed paths @rlidwka - -3.4.7 / 2013-12-10 -================== - - * update connect - -3.4.6 / 2013-12-01 -================== - - * update connect (raw-body) - -3.4.5 / 2013-11-27 -================== - - * update connect - * res.location: remove leading ./ #1802 @kapouer - * res.redirect: fix `res.redirect('toString') #1829 @michaelficarra - * res.send: always send ETag when content-length > 0 - * router: add Router.all() method - -3.4.4 / 2013-10-29 -================== - - * update connect - * update supertest - * update methods - * express(1): replace bodyParser() with urlencoded() and json() #1795 @chirag04 - -3.4.3 / 2013-10-23 -================== - - * update connect - -3.4.2 / 2013-10-18 -================== - - * update connect - * downgrade commander - -3.4.1 / 2013-10-15 -================== - - * update connect - * update commander - * jsonp: check if callback is a function - * router: wrap encodeURIComponent in a try/catch #1735 (@lxe) - * res.format: now includes chraset @1747 (@sorribas) - * res.links: allow multiple calls @1746 (@sorribas) - -3.4.0 / 2013-09-07 -================== - - * add res.vary(). Closes #1682 - * update connect - -3.3.8 / 2013-09-02 -================== - - * update connect - -3.3.7 / 2013-08-28 -================== - - * update connect - -3.3.6 / 2013-08-27 -================== - - * Revert "remove charset from json responses. Closes #1631" (causes issues in some clients) - * add: req.accepts take an argument list - -3.3.4 / 2013-07-08 -================== - - * update send and connect - -3.3.3 / 2013-07-04 -================== - - * update connect - -3.3.2 / 2013-07-03 -================== - - * update connect - * update send - * remove .version export - -3.3.1 / 2013-06-27 -================== - - * update connect - -3.3.0 / 2013-06-26 -================== - - * update connect - * add support for multiple X-Forwarded-Proto values. Closes #1646 - * change: remove charset from json responses. Closes #1631 - * change: return actual booleans from req.accept* functions - * fix jsonp callback array throw - -3.2.6 / 2013-06-02 -================== - - * update connect - -3.2.5 / 2013-05-21 -================== - - * update connect - * update node-cookie - * add: throw a meaningful error when there is no default engine - * change generation of ETags with res.send() to GET requests only. Closes #1619 - -3.2.4 / 2013-05-09 -================== - - * fix `req.subdomains` when no Host is present - * fix `req.host` when no Host is present, return undefined - -3.2.3 / 2013-05-07 -================== - - * update connect / qs - -3.2.2 / 2013-05-03 -================== - - * update qs - -3.2.1 / 2013-04-29 -================== - - * add app.VERB() paths array deprecation warning - * update connect - * update qs and remove all ~ semver crap - * fix: accept number as value of Signed Cookie - -3.2.0 / 2013-04-15 -================== - - * add "view" constructor setting to override view behaviour - * add req.acceptsEncoding(name) - * add req.acceptedEncodings - * revert cookie signature change causing session race conditions - * fix sorting of Accept values of the same quality - -3.1.2 / 2013-04-12 -================== - - * add support for custom Accept parameters - * update cookie-signature - -3.1.1 / 2013-04-01 -================== - - * add X-Forwarded-Host support to `req.host` - * fix relative redirects - * update mkdirp - * update buffer-crc32 - * remove legacy app.configure() method from app template. - -3.1.0 / 2013-01-25 -================== - - * add support for leading "." in "view engine" setting - * add array support to `res.set()` - * add node 0.8.x to travis.yml - * add "subdomain offset" setting for tweaking `req.subdomains` - * add `res.location(url)` implementing `res.redirect()`-like setting of Location - * use app.get() for x-powered-by setting for inheritance - * fix colons in passwords for `req.auth` - -3.0.6 / 2013-01-04 -================== - - * add http verb methods to Router - * update connect - * fix mangling of the `res.cookie()` options object - * fix jsonp whitespace escape. Closes #1132 - -3.0.5 / 2012-12-19 -================== - - * add throwing when a non-function is passed to a route - * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses - * revert "add 'etag' option" - -3.0.4 / 2012-12-05 -================== - - * add 'etag' option to disable `res.send()` Etags - * add escaping of urls in text/plain in `res.redirect()` - for old browsers interpreting as html - * change crc32 module for a more liberal license - * update connect - -3.0.3 / 2012-11-13 -================== - - * update connect - * update cookie module - * fix cookie max-age - -3.0.2 / 2012-11-08 -================== - - * add OPTIONS to cors example. Closes #1398 - * fix route chaining regression. Closes #1397 - -3.0.1 / 2012-11-01 -================== - - * update connect - -3.0.0 / 2012-10-23 -================== - - * add `make clean` - * add "Basic" check to req.auth - * add `req.auth` test coverage - * add cb && cb(payload) to `res.jsonp()`. Closes #1374 - * add backwards compat for `res.redirect()` status. Closes #1336 - * add support for `res.json()` to retain previously defined Content-Types. Closes #1349 - * update connect - * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382 - * remove non-primitive string support for `res.send()` - * fix view-locals example. Closes #1370 - * fix route-separation example - -3.0.0rc5 / 2012-09-18 -================== - - * update connect - * add redis search example - * add static-files example - * add "x-powered-by" setting (`app.disable('x-powered-by')`) - * add "application/octet-stream" redirect Accept test case. Closes #1317 - -3.0.0rc4 / 2012-08-30 -================== - - * add `res.jsonp()`. Closes #1307 - * add "verbose errors" option to error-pages example - * add another route example to express(1) so people are not so confused - * add redis online user activity tracking example - * update connect dep - * fix etag quoting. Closes #1310 - * fix error-pages 404 status - * fix jsonp callback char restrictions - * remove old OPTIONS default response - -3.0.0rc3 / 2012-08-13 -================== - - * update connect dep - * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds] - * fix `res.render()` clobbering of "locals" - -3.0.0rc2 / 2012-08-03 -================== - - * add CORS example - * update connect dep - * deprecate `.createServer()` & remove old stale examples - * fix: escape `res.redirect()` link - * fix vhost example - -3.0.0rc1 / 2012-07-24 -================== - - * add more examples to view-locals - * add scheme-relative redirects (`res.redirect("//foo.com")`) support - * update cookie dep - * update connect dep - * update send dep - * fix `express(1)` -h flag, use -H for hogan. Closes #1245 - * fix `res.sendfile()` socket error handling regression - -3.0.0beta7 / 2012-07-16 -================== - - * update connect dep for `send()` root normalization regression - -3.0.0beta6 / 2012-07-13 -================== - - * add `err.view` property for view errors. Closes #1226 - * add "jsonp callback name" setting - * add support for "/foo/:bar*" non-greedy matches - * change `res.sendfile()` to use `send()` module - * change `res.send` to use "response-send" module - * remove `app.locals.use` and `res.locals.use`, use regular middleware - -3.0.0beta5 / 2012-07-03 -================== - - * add "make check" support - * add route-map example - * add `res.json(obj, status)` support back for BC - * add "methods" dep, remove internal methods module - * update connect dep - * update auth example to utilize cores pbkdf2 - * updated tests to use "supertest" - -3.0.0beta4 / 2012-06-25 -================== - - * Added `req.auth` - * Added `req.range(size)` - * Added `res.links(obj)` - * Added `res.send(body, status)` support back for backwards compat - * Added `.default()` support to `res.format()` - * Added 2xx / 304 check to `req.fresh` - * Revert "Added + support to the router" - * Fixed `res.send()` freshness check, respect res.statusCode - -3.0.0beta3 / 2012-06-15 -================== - - * Added hogan `--hjs` to express(1) [nullfirm] - * Added another example to content-negotiation - * Added `fresh` dep - * Changed: `res.send()` always checks freshness - * Fixed: expose connects mime module. Cloases #1165 - -3.0.0beta2 / 2012-06-06 -================== - - * Added `+` support to the router - * Added `req.host` - * Changed `req.param()` to check route first - * Update connect dep - -3.0.0beta1 / 2012-06-01 -================== - - * Added `res.format()` callback to override default 406 behaviour - * Fixed `res.redirect()` 406. Closes #1154 - -3.0.0alpha5 / 2012-05-30 -================== - - * Added `req.ip` - * Added `{ signed: true }` option to `res.cookie()` - * Removed `res.signedCookie()` - * Changed: dont reverse `req.ips` - * Fixed "trust proxy" setting check for `req.ips` - -3.0.0alpha4 / 2012-05-09 -================== - - * Added: allow `[]` in jsonp callback. Closes #1128 - * Added `PORT` env var support in generated template. Closes #1118 [benatkin] - * Updated: connect 2.2.2 - -3.0.0alpha3 / 2012-05-04 -================== - - * Added public `app.routes`. Closes #887 - * Added _view-locals_ example - * Added _mvc_ example - * Added `res.locals.use()`. Closes #1120 - * Added conditional-GET support to `res.send()` - * Added: coerce `res.set()` values to strings - * Changed: moved `static()` in generated apps below router - * Changed: `res.send()` only set ETag when not previously set - * Changed connect 2.2.1 dep - * Changed: `make test` now runs unit / acceptance tests - * Fixed req/res proto inheritance - -3.0.0alpha2 / 2012-04-26 -================== - - * Added `make benchmark` back - * Added `res.send()` support for `String` objects - * Added client-side data exposing example - * Added `res.header()` and `req.header()` aliases for BC - * Added `express.createServer()` for BC - * Perf: memoize parsed urls - * Perf: connect 2.2.0 dep - * Changed: make `expressInit()` middleware self-aware - * Fixed: use app.get() for all core settings - * Fixed redis session example - * Fixed session example. Closes #1105 - * Fixed generated express dep. Closes #1078 - -3.0.0alpha1 / 2012-04-15 -================== - - * Added `app.locals.use(callback)` - * Added `app.locals` object - * Added `app.locals(obj)` - * Added `res.locals` object - * Added `res.locals(obj)` - * Added `res.format()` for content-negotiation - * Added `app.engine()` - * Added `res.cookie()` JSON cookie support - * Added "trust proxy" setting - * Added `req.subdomains` - * Added `req.protocol` - * Added `req.secure` - * Added `req.path` - * Added `req.ips` - * Added `req.fresh` - * Added `req.stale` - * Added comma-delmited / array support for `req.accepts()` - * Added debug instrumentation - * Added `res.set(obj)` - * Added `res.set(field, value)` - * Added `res.get(field)` - * Added `app.get(setting)`. Closes #842 - * Added `req.acceptsLanguage()` - * Added `req.acceptsCharset()` - * Added `req.accepted` - * Added `req.acceptedLanguages` - * Added `req.acceptedCharsets` - * Added "json replacer" setting - * Added "json spaces" setting - * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92 - * Added `--less` support to express(1) - * Added `express.response` prototype - * Added `express.request` prototype - * Added `express.application` prototype - * Added `app.path()` - * Added `app.render()` - * Added `res.type()` to replace `res.contentType()` - * Changed: `res.redirect()` to add relative support - * Changed: enable "jsonp callback" by default - * Changed: renamed "case sensitive routes" to "case sensitive routing" - * Rewrite of all tests with mocha - * Removed "root" setting - * Removed `res.redirect('home')` support - * Removed `req.notify()` - * Removed `app.register()` - * Removed `app.redirect()` - * Removed `app.is()` - * Removed `app.helpers()` - * Removed `app.dynamicHelpers()` - * Fixed `res.sendfile()` with non-GET. Closes #723 - * Fixed express(1) public dir for windows. Closes #866 - -2.5.9/ 2012-04-02 -================== - - * Added support for PURGE request method [pbuyle] - * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki] - -2.5.8 / 2012-02-08 -================== - - * Update mkdirp dep. Closes #991 - -2.5.7 / 2012-02-06 -================== - - * Fixed `app.all` duplicate DELETE requests [mscdex] - -2.5.6 / 2012-01-13 -================== - - * Updated hamljs dev dep. Closes #953 - -2.5.5 / 2012-01-08 -================== - - * Fixed: set `filename` on cached templates [matthewleon] - -2.5.4 / 2012-01-02 -================== - - * Fixed `express(1)` eol on 0.4.x. Closes #947 - -2.5.3 / 2011-12-30 -================== - - * Fixed `req.is()` when a charset is present - -2.5.2 / 2011-12-10 -================== - - * Fixed: express(1) LF -> CRLF for windows - -2.5.1 / 2011-11-17 -================== - - * Changed: updated connect to 1.8.x - * Removed sass.js support from express(1) - -2.5.0 / 2011-10-24 -================== - - * Added ./routes dir for generated app by default - * Added npm install reminder to express(1) app gen - * Added 0.5.x support - * Removed `make test-cov` since it wont work with node 0.5.x - * Fixed express(1) public dir for windows. Closes #866 - -2.4.7 / 2011-10-05 -================== - - * Added mkdirp to express(1). Closes #795 - * Added simple _json-config_ example - * Added shorthand for the parsed request's pathname via `req.path` - * Changed connect dep to 1.7.x to fix npm issue... - * Fixed `res.redirect()` __HEAD__ support. [reported by xerox] - * Fixed `req.flash()`, only escape args - * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie] - -2.4.6 / 2011-08-22 -================== - - * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode] - -2.4.5 / 2011-08-19 -================== - - * Added support for routes to handle errors. Closes #809 - * Added `app.routes.all()`. Closes #803 - * Added "basepath" setting to work in conjunction with reverse proxies etc. - * Refactored `Route` to use a single array of callbacks - * Added support for multiple callbacks for `app.param()`. Closes #801 -Closes #805 - * Changed: removed .call(self) for route callbacks - * Dependency: `qs >= 0.3.1` - * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808 - -2.4.4 / 2011-08-05 -================== - - * Fixed `res.header()` intention of a set, even when `undefined` - * Fixed `*`, value no longer required - * Fixed `res.send(204)` support. Closes #771 - -2.4.3 / 2011-07-14 -================== - - * Added docs for `status` option special-case. Closes #739 - * Fixed `options.filename`, exposing the view path to template engines - -2.4.2. / 2011-07-06 -================== - - * Revert "removed jsonp stripping" for XSS - -2.4.1 / 2011-07-06 -================== - - * Added `res.json()` JSONP support. Closes #737 - * Added _extending-templates_ example. Closes #730 - * Added "strict routing" setting for trailing slashes - * Added support for multiple envs in `app.configure()` calls. Closes #735 - * Changed: `res.send()` using `res.json()` - * Changed: when cookie `path === null` don't default it - * Changed; default cookie path to "home" setting. Closes #731 - * Removed _pids/logs_ creation from express(1) - -2.4.0 / 2011-06-28 -================== - - * Added chainable `res.status(code)` - * Added `res.json()`, an explicit version of `res.send(obj)` - * Added simple web-service example - -2.3.12 / 2011-06-22 -================== - - * \#express is now on freenode! come join! - * Added `req.get(field, param)` - * Added links to Japanese documentation, thanks @hideyukisaito! - * Added; the `express(1)` generated app outputs the env - * Added `content-negotiation` example - * Dependency: connect >= 1.5.1 < 2.0.0 - * Fixed view layout bug. Closes #720 - * Fixed; ignore body on 304. Closes #701 - -2.3.11 / 2011-06-04 -================== - - * Added `npm test` - * Removed generation of dummy test file from `express(1)` - * Fixed; `express(1)` adds express as a dep - * Fixed; prune on `prepublish` - -2.3.10 / 2011-05-27 -================== - - * Added `req.route`, exposing the current route - * Added _package.json_ generation support to `express(1)` - * Fixed call to `app.param()` function for optional params. Closes #682 - -2.3.9 / 2011-05-25 -================== - - * Fixed bug-ish with `../' in `res.partial()` calls - -2.3.8 / 2011-05-24 -================== - - * Fixed `app.options()` - -2.3.7 / 2011-05-23 -================== - - * Added route `Collection`, ex: `app.get('/user/:id').remove();` - * Added support for `app.param(fn)` to define param logic - * Removed `app.param()` support for callback with return value - * Removed module.parent check from express(1) generated app. Closes #670 - * Refactored router. Closes #639 - -2.3.6 / 2011-05-20 -================== - - * Changed; using devDependencies instead of git submodules - * Fixed redis session example - * Fixed markdown example - * Fixed view caching, should not be enabled in development - -2.3.5 / 2011-05-20 -================== - - * Added export `.view` as alias for `.View` - -2.3.4 / 2011-05-08 -================== - - * Added `./examples/say` - * Fixed `res.sendfile()` bug preventing the transfer of files with spaces - -2.3.3 / 2011-05-03 -================== - - * Added "case sensitive routes" option. - * Changed; split methods supported per rfc [slaskis] - * Fixed route-specific middleware when using the same callback function several times - -2.3.2 / 2011-04-27 -================== - - * Fixed view hints - -2.3.1 / 2011-04-26 -================== - - * Added `app.match()` as `app.match.all()` - * Added `app.lookup()` as `app.lookup.all()` - * Added `app.remove()` for `app.remove.all()` - * Added `app.remove.VERB()` - * Fixed template caching collision issue. Closes #644 - * Moved router over from connect and started refactor - -2.3.0 / 2011-04-25 -================== - - * Added options support to `res.clearCookie()` - * Added `res.helpers()` as alias of `res.locals()` - * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel * Dependency `connect >= 1.4.0` - * Changed; auto set Content-Type in res.attachement [Aaron Heckmann] - * Renamed "cache views" to "view cache". Closes #628 - * Fixed caching of views when using several apps. Closes #637 - * Fixed gotcha invoking `app.param()` callbacks once per route middleware. -Closes #638 - * Fixed partial lookup precedence. Closes #631 -Shaw] - -2.2.2 / 2011-04-12 -================== - - * Added second callback support for `res.download()` connection errors - * Fixed `filename` option passing to template engine - -2.2.1 / 2011-04-04 -================== - - * Added `layout(path)` helper to change the layout within a view. Closes #610 - * Fixed `partial()` collection object support. - Previously only anything with `.length` would work. - When `.length` is present one must still be aware of holes, - however now `{ collection: {foo: 'bar'}}` is valid, exposes - `keyInCollection` and `keysInCollection`. - - * Performance improved with better view caching - * Removed `request` and `response` locals - * Changed; errorHandler page title is now `Express` instead of `Connect` - -2.2.0 / 2011-03-30 -================== - - * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606 - * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606 - * Added `app.VERB(path)` as alias of `app.lookup.VERB()`. - * Dependency `connect >= 1.2.0` - -2.1.1 / 2011-03-29 -================== - - * Added; expose `err.view` object when failing to locate a view - * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann] - * Fixed; `res.send(undefined)` responds with 204 [aheckmann] - -2.1.0 / 2011-03-24 -================== - - * Added `/_?` partial lookup support. Closes #447 - * Added `request`, `response`, and `app` local variables - * Added `settings` local variable, containing the app's settings - * Added `req.flash()` exception if `req.session` is not available - * Added `res.send(bool)` support (json response) - * Fixed stylus example for latest version - * Fixed; wrap try/catch around `res.render()` - -2.0.0 / 2011-03-17 -================== - - * Fixed up index view path alternative. - * Changed; `res.locals()` without object returns the locals - -2.0.0rc3 / 2011-03-17 -================== - - * Added `res.locals(obj)` to compliment `res.local(key, val)` - * Added `res.partial()` callback support - * Fixed recursive error reporting issue in `res.render()` - -2.0.0rc2 / 2011-03-17 -================== - - * Changed; `partial()` "locals" are now optional - * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01] - * Fixed .filename view engine option [reported by drudge] - * Fixed blog example - * Fixed `{req,res}.app` reference when mounting [Ben Weaver] - -2.0.0rc / 2011-03-14 -================== - - * Fixed; expose `HTTPSServer` constructor - * Fixed express(1) default test charset. Closes #579 [reported by secoif] - * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP] - -2.0.0beta3 / 2011-03-09 -================== - - * Added support for `res.contentType()` literal - The original `res.contentType('.json')`, - `res.contentType('application/json')`, and `res.contentType('json')` - will work now. - * Added `res.render()` status option support back - * Added charset option for `res.render()` - * Added `.charset` support (via connect 1.0.4) - * Added view resolution hints when in development and a lookup fails - * Added layout lookup support relative to the page view. - For example while rendering `./views/user/index.jade` if you create - `./views/user/layout.jade` it will be used in favour of the root layout. - * Fixed `res.redirect()`. RFC states absolute url [reported by unlink] - * Fixed; default `res.send()` string charset to utf8 - * Removed `Partial` constructor (not currently used) - -2.0.0beta2 / 2011-03-07 -================== - - * Added res.render() `.locals` support back to aid in migration process - * Fixed flash example - -2.0.0beta / 2011-03-03 -================== - - * Added HTTPS support - * Added `res.cookie()` maxAge support - * Added `req.header()` _Referrer_ / _Referer_ special-case, either works - * Added mount support for `res.redirect()`, now respects the mount-point - * Added `union()` util, taking place of `merge(clone())` combo - * Added stylus support to express(1) generated app - * Added secret to session middleware used in examples and generated app - * Added `res.local(name, val)` for progressive view locals - * Added default param support to `req.param(name, default)` - * Added `app.disabled()` and `app.enabled()` - * Added `app.register()` support for omitting leading ".", either works - * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539 - * Added `app.param()` to map route params to async/sync logic - * Added; aliased `app.helpers()` as `app.locals()`. Closes #481 - * Added extname with no leading "." support to `res.contentType()` - * Added `cache views` setting, defaulting to enabled in "production" env - * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_. - * Added `req.accepts()` support for extensions - * Changed; `res.download()` and `res.sendfile()` now utilize Connect's - static file server `connect.static.send()`. - * Changed; replaced `connect.utils.mime()` with npm _mime_ module - * Changed; allow `req.query` to be pre-defined (via middleware or other parent - * Changed view partial resolution, now relative to parent view - * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`. - * Fixed `req.param()` bug returning Array.prototype methods. Closes #552 - * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()` - * Fixed; using _qs_ module instead of _querystring_ - * Fixed; strip unsafe chars from jsonp callbacks - * Removed "stream threshold" setting - -1.0.8 / 2011-03-01 -================== - - * Allow `req.query` to be pre-defined (via middleware or other parent app) - * "connect": ">= 0.5.0 < 1.0.0". Closes #547 - * Removed the long deprecated __EXPRESS_ENV__ support - -1.0.7 / 2011-02-07 -================== - - * Fixed `render()` setting inheritance. - Mounted apps would not inherit "view engine" - -1.0.6 / 2011-02-07 -================== - - * Fixed `view engine` setting bug when period is in dirname - -1.0.5 / 2011-02-05 -================== - - * Added secret to generated app `session()` call - -1.0.4 / 2011-02-05 -================== - - * Added `qs` dependency to _package.json_ - * Fixed namespaced `require()`s for latest connect support - -1.0.3 / 2011-01-13 -================== - - * Remove unsafe characters from JSONP callback names [Ryan Grove] - -1.0.2 / 2011-01-10 -================== - - * Removed nested require, using `connect.router` - -1.0.1 / 2010-12-29 -================== - - * Fixed for middleware stacked via `createServer()` - previously the `foo` middleware passed to `createServer(foo)` - would not have access to Express methods such as `res.send()` - or props like `req.query` etc. - -1.0.0 / 2010-11-16 -================== - - * Added; deduce partial object names from the last segment. - For example by default `partial('forum/post', postObject)` will - give you the _post_ object, providing a meaningful default. - * Added http status code string representation to `res.redirect()` body - * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__. - * Added `req.is()` to aid in content negotiation - * Added partial local inheritance [suggested by masylum]. Closes #102 - providing access to parent template locals. - * Added _-s, --session[s]_ flag to express(1) to add session related middleware - * Added _--template_ flag to express(1) to specify the - template engine to use. - * Added _--css_ flag to express(1) to specify the - stylesheet engine to use (or just plain css by default). - * Added `app.all()` support [thanks aheckmann] - * Added partial direct object support. - You may now `partial('user', user)` providing the "user" local, - vs previously `partial('user', { object: user })`. - * Added _route-separation_ example since many people question ways - to do this with CommonJS modules. Also view the _blog_ example for - an alternative. - * Performance; caching view path derived partial object names - * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454 - * Fixed jsonp support; _text/javascript_ as per mailinglist discussion - -1.0.0rc4 / 2010-10-14 -================== - - * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0 - * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware)) - * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass] - * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass] - * Added `partial()` support for array-like collections. Closes #434 - * Added support for swappable querystring parsers - * Added session usage docs. Closes #443 - * Added dynamic helper caching. Closes #439 [suggested by maritz] - * Added authentication example - * Added basic Range support to `res.sendfile()` (and `res.download()` etc) - * Changed; `express(1)` generated app using 2 spaces instead of 4 - * Default env to "development" again [aheckmann] - * Removed _context_ option is no more, use "scope" - * Fixed; exposing _./support_ libs to examples so they can run without installs - * Fixed mvc example - -1.0.0rc3 / 2010-09-20 -================== - - * Added confirmation for `express(1)` app generation. Closes #391 - * Added extending of flash formatters via `app.flashFormatters` - * Added flash formatter support. Closes #411 - * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold" - * Added _stream threshold_ setting for `res.sendfile()` - * Added `res.send()` __HEAD__ support - * Added `res.clearCookie()` - * Added `res.cookie()` - * Added `res.render()` headers option - * Added `res.redirect()` response bodies - * Added `res.render()` status option support. Closes #425 [thanks aheckmann] - * Fixed `res.sendfile()` responding with 403 on malicious path - * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_ - * Fixed; mounted apps settings now inherit from parent app [aheckmann] - * Fixed; stripping Content-Length / Content-Type when 204 - * Fixed `res.send()` 204. Closes #419 - * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402 - * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo] - - -1.0.0rc2 / 2010-08-17 -================== - - * Added `app.register()` for template engine mapping. Closes #390 - * Added `res.render()` callback support as second argument (no options) - * Added callback support to `res.download()` - * Added callback support for `res.sendfile()` - * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()` - * Added "partials" setting to docs - * Added default expresso tests to `express(1)` generated app. Closes #384 - * Fixed `res.sendfile()` error handling, defer via `next()` - * Fixed `res.render()` callback when a layout is used [thanks guillermo] - * Fixed; `make install` creating ~/.node_libraries when not present - * Fixed issue preventing error handlers from being defined anywhere. Closes #387 - -1.0.0rc / 2010-07-28 -================== - - * Added mounted hook. Closes #369 - * Added connect dependency to _package.json_ - - * Removed "reload views" setting and support code - development env never caches, production always caches. - - * Removed _param_ in route callbacks, signature is now - simply (req, res, next), previously (req, res, params, next). - Use _req.params_ for path captures, _req.query_ for GET params. - - * Fixed "home" setting - * Fixed middleware/router precedence issue. Closes #366 - * Fixed; _configure()_ callbacks called immediately. Closes #368 - -1.0.0beta2 / 2010-07-23 -================== - - * Added more examples - * Added; exporting `Server` constructor - * Added `Server#helpers()` for view locals - * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349 - * Added support for absolute view paths - * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363 - * Added Guillermo Rauch to the contributor list - * Added support for "as" for non-collection partials. Closes #341 - * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf] - * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo] - * Fixed instanceof `Array` checks, now `Array.isArray()` - * Fixed express(1) expansion of public dirs. Closes #348 - * Fixed middleware precedence. Closes #345 - * Fixed view watcher, now async [thanks aheckmann] - -1.0.0beta / 2010-07-15 -================== - - * Re-write - - much faster - - much lighter - - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs - -0.14.0 / 2010-06-15 -================== - - * Utilize relative requires - * Added Static bufferSize option [aheckmann] - * Fixed caching of view and partial subdirectories [aheckmann] - * Fixed mime.type() comments now that ".ext" is not supported - * Updated haml submodule - * Updated class submodule - * Removed bin/express - -0.13.0 / 2010-06-01 -================== - - * Added node v0.1.97 compatibility - * Added support for deleting cookies via Request#cookie('key', null) - * Updated haml submodule - * Fixed not-found page, now using using charset utf-8 - * Fixed show-exceptions page, now using using charset utf-8 - * Fixed view support due to fs.readFile Buffers - * Changed; mime.type() no longer accepts ".type" due to node extname() changes - -0.12.0 / 2010-05-22 -================== - - * Added node v0.1.96 compatibility - * Added view `helpers` export which act as additional local variables - * Updated haml submodule - * Changed ETag; removed inode, modified time only - * Fixed LF to CRLF for setting multiple cookies - * Fixed cookie complation; values are now urlencoded - * Fixed cookies parsing; accepts quoted values and url escaped cookies - -0.11.0 / 2010-05-06 -================== - - * Added support for layouts using different engines - - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' }) - - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml' - - this.render('page.html.haml', { layout: false }) // no layout - * Updated ext submodule - * Updated haml submodule - * Fixed EJS partial support by passing along the context. Issue #307 - -0.10.1 / 2010-05-03 -================== - - * Fixed binary uploads. - -0.10.0 / 2010-04-30 -================== - - * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s - encoding is set to 'utf8' or 'utf-8'. - * Added "encoding" option to Request#render(). Closes #299 - * Added "dump exceptions" setting, which is enabled by default. - * Added simple ejs template engine support - * Added error reponse support for text/plain, application/json. Closes #297 - * Added callback function param to Request#error() - * Added Request#sendHead() - * Added Request#stream() - * Added support for Request#respond(304, null) for empty response bodies - * Added ETag support to Request#sendfile() - * Added options to Request#sendfile(), passed to fs.createReadStream() - * Added filename arg to Request#download() - * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request - * Performance enhanced by preventing several calls to toLowerCase() in Router#match() - * Changed; Request#sendfile() now streams - * Changed; Renamed Request#halt() to Request#respond(). Closes #289 - * Changed; Using sys.inspect() instead of JSON.encode() for error output - * Changed; run() returns the http.Server instance. Closes #298 - * Changed; Defaulting Server#host to null (INADDR_ANY) - * Changed; Logger "common" format scale of 0.4f - * Removed Logger "request" format - * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found - * Fixed several issues with http client - * Fixed Logger Content-Length output - * Fixed bug preventing Opera from retaining the generated session id. Closes #292 - -0.9.0 / 2010-04-14 -================== - - * Added DSL level error() route support - * Added DSL level notFound() route support - * Added Request#error() - * Added Request#notFound() - * Added Request#render() callback function. Closes #258 - * Added "max upload size" setting - * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254 - * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js - * Added callback function support to Request#halt() as 3rd/4th arg - * Added preprocessing of route param wildcards using param(). Closes #251 - * Added view partial support (with collections etc) - * Fixed bug preventing falsey params (such as ?page=0). Closes #286 - * Fixed setting of multiple cookies. Closes #199 - * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml) - * Changed; session cookie is now httpOnly - * Changed; Request is no longer global - * Changed; Event is no longer global - * Changed; "sys" module is no longer global - * Changed; moved Request#download to Static plugin where it belongs - * Changed; Request instance created before body parsing. Closes #262 - * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253 - * Changed; Pre-caching view partials in memory when "cache view partials" is enabled - * Updated support to node --version 0.1.90 - * Updated dependencies - * Removed set("session cookie") in favour of use(Session, { cookie: { ... }}) - * Removed utils.mixin(); use Object#mergeDeep() - -0.8.0 / 2010-03-19 -================== - - * Added coffeescript example app. Closes #242 - * Changed; cache api now async friendly. Closes #240 - * Removed deprecated 'express/static' support. Use 'express/plugins/static' - -0.7.6 / 2010-03-19 -================== - - * Added Request#isXHR. Closes #229 - * Added `make install` (for the executable) - * Added `express` executable for setting up simple app templates - * Added "GET /public/*" to Static plugin, defaulting to /public - * Added Static plugin - * Fixed; Request#render() only calls cache.get() once - * Fixed; Namespacing View caches with "view:" - * Fixed; Namespacing Static caches with "static:" - * Fixed; Both example apps now use the Static plugin - * Fixed set("views"). Closes #239 - * Fixed missing space for combined log format - * Deprecated Request#sendfile() and 'express/static' - * Removed Server#running - -0.7.5 / 2010-03-16 -================== - - * Added Request#flash() support without args, now returns all flashes - * Updated ext submodule - -0.7.4 / 2010-03-16 -================== - - * Fixed session reaper - * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft) - -0.7.3 / 2010-03-16 -================== - - * Added package.json - * Fixed requiring of haml / sass due to kiwi removal - -0.7.2 / 2010-03-16 -================== - - * Fixed GIT submodules (HAH!) - -0.7.1 / 2010-03-16 -================== - - * Changed; Express now using submodules again until a PM is adopted - * Changed; chat example using millisecond conversions from ext - -0.7.0 / 2010-03-15 -================== - - * Added Request#pass() support (finds the next matching route, or the given path) - * Added Logger plugin (default "common" format replaces CommonLogger) - * Removed Profiler plugin - * Removed CommonLogger plugin - -0.6.0 / 2010-03-11 -================== - - * Added seed.yml for kiwi package management support - * Added HTTP client query string support when method is GET. Closes #205 - - * Added support for arbitrary view engines. - For example "foo.engine.html" will now require('engine'), - the exports from this module are cached after the first require(). - - * Added async plugin support - - * Removed usage of RESTful route funcs as http client - get() etc, use http.get() and friends - - * Removed custom exceptions - -0.5.0 / 2010-03-10 -================== - - * Added ext dependency (library of js extensions) - * Removed extname() / basename() utils. Use path module - * Removed toArray() util. Use arguments.values - * Removed escapeRegexp() util. Use RegExp.escape() - * Removed process.mixin() dependency. Use utils.mixin() - * Removed Collection - * Removed ElementCollection - * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com) ;) - -0.4.0 / 2010-02-11 -================== - - * Added flash() example to sample upload app - * Added high level restful http client module (express/http) - * Changed; RESTful route functions double as HTTP clients. Closes #69 - * Changed; throwing error when routes are added at runtime - * Changed; defaulting render() context to the current Request. Closes #197 - * Updated haml submodule - -0.3.0 / 2010-02-11 -================== - - * Updated haml / sass submodules. Closes #200 - * Added flash message support. Closes #64 - * Added accepts() now allows multiple args. fixes #117 - * Added support for plugins to halt. Closes #189 - * Added alternate layout support. Closes #119 - * Removed Route#run(). Closes #188 - * Fixed broken specs due to use(Cookie) missing - -0.2.1 / 2010-02-05 -================== - - * Added "plot" format option for Profiler (for gnuplot processing) - * Added request number to Profiler plugin - * Fixed binary encoding for multi-part file uploads, was previously defaulting to UTF8 - * Fixed issue with routes not firing when not files are present. Closes #184 - * Fixed process.Promise -> events.Promise - -0.2.0 / 2010-02-03 -================== - - * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180 - * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174 - * Added expiration support to cache api with reaper. Closes #133 - * Added cache Store.Memory#reap() - * Added Cache; cache api now uses first class Cache instances - * Added abstract session Store. Closes #172 - * Changed; cache Memory.Store#get() utilizing Collection - * Renamed MemoryStore -> Store.Memory - * Fixed use() of the same plugin several time will always use latest options. Closes #176 - -0.1.0 / 2010-02-03 -================== - - * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context - * Updated node support to 0.1.27 Closes #169 - * Updated dirname(__filename) -> __dirname - * Updated libxmljs support to v0.2.0 - * Added session support with memory store / reaping - * Added quick uid() helper - * Added multi-part upload support - * Added Sass.js support / submodule - * Added production env caching view contents and static files - * Added static file caching. Closes #136 - * Added cache plugin with memory stores - * Added support to StaticFile so that it works with non-textual files. - * Removed dirname() helper - * Removed several globals (now their modules must be required) - -0.0.2 / 2010-01-10 -================== - - * Added view benchmarks; currently haml vs ejs - * Added Request#attachment() specs. Closes #116 - * Added use of node's parseQuery() util. Closes #123 - * Added `make init` for submodules - * Updated Haml - * Updated sample chat app to show messages on load - * Updated libxmljs parseString -> parseHtmlString - * Fixed `make init` to work with older versions of git - * Fixed specs can now run independant specs for those who cant build deps. Closes #127 - * Fixed issues introduced by the node url module changes. Closes 126. - * Fixed two assertions failing due to Collection#keys() returning strings - * Fixed faulty Collection#toArray() spec due to keys() returning strings - * Fixed `make test` now builds libxmljs.node before testing - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/express/LICENSE b/realtime/node_modules/express/LICENSE deleted file mode 100644 index d23e93ce..00000000 --- a/realtime/node_modules/express/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2009-2013 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/realtime/node_modules/express/Makefile b/realtime/node_modules/express/Makefile deleted file mode 100644 index a1f33a70..00000000 --- a/realtime/node_modules/express/Makefile +++ /dev/null @@ -1,34 +0,0 @@ - -MOCHA_OPTS= --check-leaks -REPORTER = dot - -check: test - -test: test-unit test-acceptance - -test-unit: - @NODE_ENV=test ./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - --globals setImmediate,clearImmediate \ - $(MOCHA_OPTS) - -test-acceptance: - @NODE_ENV=test ./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - --bail \ - test/acceptance/*.js - -test-cov: lib-cov - @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html - -lib-cov: - @jscoverage lib lib-cov - -bench: - @$(MAKE) -C benchmarks - -clean: - rm -f coverage.html - rm -fr lib-cov - -.PHONY: test test-unit test-acceptance bench clean diff --git a/realtime/node_modules/express/Readme.md b/realtime/node_modules/express/Readme.md deleted file mode 100644 index e1e3f7e9..00000000 --- a/realtime/node_modules/express/Readme.md +++ /dev/null @@ -1,126 +0,0 @@ -[![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)](http://expressjs.com/) - - Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). - - [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Gittip](http://img.shields.io/gittip/visionmedia.png)](https://www.gittip.com/visionmedia/) - -```js -var express = require('express'); -var app = express(); - -app.get('/', function(req, res){ - res.send('Hello World'); -}); - -app.listen(3000); -``` - -## Installation - - $ npm install -g express - -## Quick Start - - The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below: - - Create the app: - - $ npm install -g express - $ express /tmp/foo && cd /tmp/foo - - Install dependencies: - - $ npm install - - Start the server: - - $ node app - -## Features - - * Built on [Connect](http://github.com/senchalabs/connect) - * Robust routing - * HTTP helpers (redirection, caching, etc) - * View system supporting 14+ template engines - * Content negotiation - * Focus on high performance - * Environment based configuration - * Executable for generating applications quickly - * High test coverage - -## Philosophy - - The Express philosophy is to provide small, robust tooling for HTTP servers, making - it a great solution for single page applications, web sites, hybrids, or public - HTTP APIs. - - Built on Connect, you can use _only_ what you need, and nothing more. Applications - can be as big or as small as you like, even a single file. Express does - not force you to use any specific ORM or template engine. With support for over - 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js), - you can quickly craft your perfect framework. - -## More Information - - * [Website and Documentation](http://expressjs.com/) stored at [visionmedia/expressjs.com](https://github.com/visionmedia/expressjs.com) - * Join #express on freenode - * [Google Group](http://groups.google.com/group/express-js) for discussion - * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates - * Visit the [Wiki](http://github.com/visionmedia/express/wiki) - * [Русскоязычная документация](http://jsman.ru/express/) - * Run express examples [online](https://runnable.com/express) - -## Viewing Examples - -Clone the Express repo, then install the dev dependencies to install all the example / test suite dependencies: - - $ git clone git://github.com/visionmedia/express.git --depth 1 - $ cd express - $ npm install - -Then run whichever tests you want: - - $ node examples/content-negotiation - -You can also view live examples here: - - - -## Running Tests - -To run the test suite, first invoke the following command within the repo, installing the development dependencies: - - $ npm install - -Then run the tests: - - $ make test - -## Contributors - - https://github.com/visionmedia/express/graphs/contributors - -## License - -(The MIT License) - -Copyright (c) 2009-2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/benchmarks/Makefile b/realtime/node_modules/express/benchmarks/Makefile deleted file mode 100644 index baf0d6fc..00000000 --- a/realtime/node_modules/express/benchmarks/Makefile +++ /dev/null @@ -1,13 +0,0 @@ - -all: - @./run 1 middleware - @./run 5 middleware - @./run 10 middleware - @./run 15 middleware - @./run 20 middleware - @./run 30 middleware - @./run 50 middleware - @./run 100 middleware - @echo - -.PHONY: all diff --git a/realtime/node_modules/express/benchmarks/middleware.js b/realtime/node_modules/express/benchmarks/middleware.js deleted file mode 100644 index 3aa7a8b4..00000000 --- a/realtime/node_modules/express/benchmarks/middleware.js +++ /dev/null @@ -1,23 +0,0 @@ - -var http = require('http'); -var express = require('..'); -var app = express(); - -// number of middleware - -var n = parseInt(process.env.MW || '1', 10); -console.log(' %s middleware', n); - -while (n--) { - app.use(function(req, res, next){ - next(); - }); -} - -var body = new Buffer('Hello World'); - -app.use(function(req, res, next){ - res.send(body); -}); - -app.listen(3333); diff --git a/realtime/node_modules/express/benchmarks/run b/realtime/node_modules/express/benchmarks/run deleted file mode 100644 index 93b5bc52..00000000 --- a/realtime/node_modules/express/benchmarks/run +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -echo -MW=$1 node $2 & -pid=$! - -sleep 2 - -wrk 'http://localhost:3333/?foo[bar]=baz' \ - -d 3 \ - -c 50 \ - -t 8 \ - | grep 'Requests/sec' \ - | awk '{ print " " $2 }' - -kill $pid diff --git a/realtime/node_modules/express/bin/express b/realtime/node_modules/express/bin/express deleted file mode 100644 index cb979288..00000000 --- a/realtime/node_modules/express/bin/express +++ /dev/null @@ -1,423 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander') - , mkdirp = require('mkdirp') - , pkg = require('../package.json') - , version = pkg.version - , os = require('os') - , fs = require('fs'); - -// CLI - -program - .version(version) - .usage('[options] [dir]') - .option('-s, --sessions', 'add session support') - .option('-e, --ejs', 'add ejs engine support (defaults to jade)') - .option('-J, --jshtml', 'add jshtml engine support (defaults to jade)') - .option('-H, --hogan', 'add hogan.js engine support') - .option('-c, --css ', 'add stylesheet support (less|stylus) (defaults to plain css)') - .option('-f, --force', 'force on non-empty directory') - .parse(process.argv); - -// Path - -var path = program.args.shift() || '.'; - -// end-of-line code - -var eol = os.EOL - -// Template engine - -program.template = 'jade'; -if (program.ejs) program.template = 'ejs'; -if (program.jshtml) program.template = 'jshtml'; -if (program.hogan) program.template = 'hjs'; - -/** - * Routes index template. - */ - -var index = [ - '' - , '/*' - , ' * GET home page.' - , ' */' - , '' - , 'exports.index = function(req, res){' - , ' res.render(\'index\', { title: \'Express\' });' - , '};' -].join(eol); - -/** - * Routes users template. - */ - -var users = [ - '' - , '/*' - , ' * GET users listing.' - , ' */' - , '' - , 'exports.list = function(req, res){' - , ' res.send("respond with a resource");' - , '};' -].join(eol); - -/** - * Jade layout template. - */ - -var jadeLayout = [ - 'doctype html' - , 'html' - , ' head' - , ' title= title' - , ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')' - , ' body' - , ' block content' -].join(eol); - -/** - * Jade index template. - */ - -var jadeIndex = [ - 'extends layout' - , '' - , 'block content' - , ' h1= title' - , ' p Welcome to #{title}' -].join(eol); - -/** - * EJS index template. - */ - -var ejsIndex = [ - '' - , '' - , ' ' - , ' <%= title %>' - , ' ' - , ' ' - , ' ' - , '

<%= title %>

' - , '

Welcome to <%= title %>

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

@write(title)

' - , '

Welcome to @write(title)

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

{{ title }}

' - , '

Welcome to {{ title }}

' - , ' ' - , '' -].join(eol); - -/** - * Default css template. - */ - -var css = [ - 'body {' - , ' padding: 50px;' - , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;' - , '}' - , '' - , 'a {' - , ' color: #00B7FF;' - , '}' -].join(eol); - -/** - * Default less template. - */ - -var less = [ - 'body {' - , ' padding: 50px;' - , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;' - , '}' - , '' - , 'a {' - , ' color: #00B7FF;' - , '}' -].join(eol); - -/** - * Default stylus template. - */ - -var stylus = [ - 'body' - , ' padding: 50px' - , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif' - , 'a' - , ' color: #00B7FF' -].join(eol); - -/** - * App template. - */ - -var app = [ - '' - , '/**' - , ' * Module dependencies.' - , ' */' - , '' - , 'var express = require(\'express\');' - , 'var routes = require(\'./routes\');' - , 'var user = require(\'./routes/user\');' - , 'var http = require(\'http\');' - , 'var path = require(\'path\');' - , '' - , 'var app = express();' - , '' - , '// all environments' - , 'app.set(\'port\', process.env.PORT || 3000);' - , 'app.set(\'views\', path.join(__dirname, \'views\'));' - , 'app.set(\'view engine\', \':TEMPLATE\');' - , 'app.use(express.favicon());' - , 'app.use(express.logger(\'dev\'));' - , 'app.use(express.json());' - , 'app.use(express.urlencoded());' - , 'app.use(express.methodOverride());{sess}' - , 'app.use(app.router);{css}' - , 'app.use(express.static(path.join(__dirname, \'public\')));' - , '' - , '// development only' - , 'if (\'development\' == app.get(\'env\')) {' - , ' app.use(express.errorHandler());' - , '}' - , '' - , 'app.get(\'/\', routes.index);' - , 'app.get(\'/users\', user.list);' - , '' - , 'http.createServer(app).listen(app.get(\'port\'), function(){' - , ' console.log(\'Express server listening on port \' + app.get(\'port\'));' - , '});' - , '' -].join(eol); - -// Generate application - -(function createApplication(path) { - emptyDirectory(path, function(empty){ - if (empty || program.force) { - createApplicationAt(path); - } else { - program.confirm('destination is not empty, continue? ', function(ok){ - if (ok) { - process.stdin.destroy(); - createApplicationAt(path); - } else { - abort('aborting'); - } - }); - } - }); -})(path); - -/** - * Create application at the given directory `path`. - * - * @param {String} path - */ - -function createApplicationAt(path) { - console.log(); - process.on('exit', function(){ - console.log(); - console.log(' install dependencies:'); - console.log(' $ cd %s && npm install', path); - console.log(); - console.log(' run the app:'); - console.log(' $ node app'); - console.log(); - }); - - mkdir(path, function(){ - mkdir(path + '/public'); - mkdir(path + '/public/javascripts'); - mkdir(path + '/public/images'); - mkdir(path + '/public/stylesheets', function(){ - switch (program.css) { - case 'less': - write(path + '/public/stylesheets/style.less', less); - break; - case 'stylus': - write(path + '/public/stylesheets/style.styl', stylus); - break; - default: - write(path + '/public/stylesheets/style.css', css); - } - }); - - mkdir(path + '/routes', function(){ - write(path + '/routes/index.js', index); - write(path + '/routes/user.js', users); - }); - - mkdir(path + '/views', function(){ - switch (program.template) { - case 'ejs': - write(path + '/views/index.ejs', ejsIndex); - break; - case 'jade': - write(path + '/views/layout.jade', jadeLayout); - write(path + '/views/index.jade', jadeIndex); - break; - case 'jshtml': - write(path + '/views/layout.jshtml', jshtmlLayout); - write(path + '/views/index.jshtml', jshtmlIndex); - break; - case 'hjs': - write(path + '/views/index.hjs', hoganIndex); - break; - - } - }); - - // CSS Engine support - switch (program.css) { - case 'less': - app = app.replace('{css}', eol + 'app.use(require(\'less-middleware\')({ src: path.join(__dirname, \'public\') }));'); - break; - case 'stylus': - app = app.replace('{css}', eol + 'app.use(require(\'stylus\').middleware(path.join(__dirname, \'public\')));'); - break; - default: - app = app.replace('{css}', ''); - } - - // Session support - app = app.replace('{sess}', program.sessions - ? eol + 'app.use(express.cookieParser(\'your secret here\'));' + eol + 'app.use(express.session());' - : ''); - - // Template support - app = app.replace(':TEMPLATE', program.template); - - // package.json - var pkg = { - name: 'application-name' - , version: '0.0.1' - , private: true - , scripts: { start: 'node app.js' } - , dependencies: { - express: version - } - } - - if (program.template) pkg.dependencies[program.template] = '*'; - - // CSS Engine support - switch (program.css) { - case 'less': - pkg.dependencies['less-middleware'] = '*'; - break; - default: - if (program.css) { - pkg.dependencies[program.css] = '*'; - } - } - - write(path + '/package.json', JSON.stringify(pkg, null, 2)); - write(path + '/app.js', app); - }); -} - -/** - * Check if the given directory `path` is empty. - * - * @param {String} path - * @param {Function} fn - */ - -function emptyDirectory(path, fn) { - fs.readdir(path, function(err, files){ - if (err && 'ENOENT' != err.code) throw err; - fn(!files || !files.length); - }); -} - -/** - * echo str > path. - * - * @param {String} path - * @param {String} str - */ - -function write(path, str) { - fs.writeFile(path, str); - console.log(' \x1b[36mcreate\x1b[0m : ' + path); -} - -/** - * Mkdir -p. - * - * @param {String} path - * @param {Function} fn - */ - -function mkdir(path, fn) { - mkdirp(path, 0755, function(err){ - if (err) throw err; - console.log(' \033[36mcreate\033[0m : ' + path); - fn && fn(); - }); -} - -/** - * Exit with the given `str`. - * - * @param {String} str - */ - -function abort(str) { - console.error(str); - process.exit(1); -} diff --git a/realtime/node_modules/express/index.js b/realtime/node_modules/express/index.js deleted file mode 100644 index bfe99345..00000000 --- a/realtime/node_modules/express/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.EXPRESS_COV - ? require('./lib-cov/express') - : require('./lib/express'); \ No newline at end of file diff --git a/realtime/node_modules/express/lib/application.js b/realtime/node_modules/express/lib/application.js deleted file mode 100644 index 865e1e02..00000000 --- a/realtime/node_modules/express/lib/application.js +++ /dev/null @@ -1,534 +0,0 @@ -/** - * Module dependencies. - */ - -var connect = require('connect') - , Router = require('./router') - , methods = require('methods') - , middleware = require('./middleware') - , debug = require('debug')('express:application') - , locals = require('./utils').locals - , View = require('./view') - , utils = connect.utils - , http = require('http'); - -/** - * Application prototype. - */ - -var app = exports = module.exports = {}; - -/** - * Initialize the server. - * - * - setup default configuration - * - setup default middleware - * - setup route reflection methods - * - * @api private - */ - -app.init = function(){ - this.cache = {}; - this.settings = {}; - this.engines = {}; - this.defaultConfiguration(); -}; - -/** - * Initialize application configuration. - * - * @api private - */ - -app.defaultConfiguration = function(){ - // default settings - this.enable('x-powered-by'); - this.enable('etag'); - this.set('env', process.env.NODE_ENV || 'development'); - this.set('subdomain offset', 2); - debug('booting in %s mode', this.get('env')); - - // implicit middleware - this.use(connect.query()); - this.use(middleware.init(this)); - - // inherit protos - this.on('mount', function(parent){ - this.request.__proto__ = parent.request; - this.response.__proto__ = parent.response; - this.engines.__proto__ = parent.engines; - this.settings.__proto__ = parent.settings; - }); - - // router - this._router = new Router(this); - this.routes = this._router.map; - this.__defineGetter__('router', function(){ - this._usedRouter = true; - this._router.caseSensitive = this.enabled('case sensitive routing'); - this._router.strict = this.enabled('strict routing'); - return this._router.middleware; - }); - - // setup locals - this.locals = locals(this); - - // default locals - this.locals.settings = this.settings; - - // default configuration - this.set('view', View); - this.set('views', process.cwd() + '/views'); - this.set('jsonp callback name', 'callback'); - - this.configure('development', function(){ - this.set('json spaces', 2); - }); - - this.configure('production', function(){ - this.enable('view cache'); - }); -}; - -/** - * Proxy `connect#use()` to apply settings to - * mounted applications. - * - * @param {String|Function|Server} route - * @param {Function|Server} fn - * @return {app} for chaining - * @api public - */ - -app.use = function(route, fn){ - var app; - - // default route to '/' - if ('string' != typeof route) fn = route, route = '/'; - - // express app - if (fn.handle && fn.set) app = fn; - - // restore .app property on req and res - if (app) { - app.route = route; - fn = function(req, res, next) { - var orig = req.app; - app.handle(req, res, function(err){ - req.__proto__ = orig.request; - res.__proto__ = orig.response; - next(err); - }); - }; - } - - connect.proto.use.call(this, route, fn); - - // mounted an app - if (app) { - app.parent = this; - app.emit('mount', this); - } - - return this; -}; - -/** - * Register the given template engine callback `fn` - * as `ext`. - * - * By default will `require()` the engine based on the - * file extension. For example if you try to render - * a "foo.jade" file Express will invoke the following internally: - * - * app.engine('jade', require('jade').__express); - * - * For engines that do not provide `.__express` out of the box, - * or if you wish to "map" a different extension to the template engine - * you may use this method. For example mapping the EJS template engine to - * ".html" files: - * - * app.engine('html', require('ejs').renderFile); - * - * In this case EJS provides a `.renderFile()` method with - * the same signature that Express expects: `(path, options, callback)`, - * though note that it aliases this method as `ejs.__express` internally - * so if you're using ".ejs" extensions you dont need to do anything. - * - * Some template engines do not follow this convention, the - * [Consolidate.js](https://github.com/visionmedia/consolidate.js) - * library was created to map all of node's popular template - * engines to follow this convention, thus allowing them to - * work seamlessly within Express. - * - * @param {String} ext - * @param {Function} fn - * @return {app} for chaining - * @api public - */ - -app.engine = function(ext, fn){ - if ('function' != typeof fn) throw new Error('callback function required'); - if ('.' != ext[0]) ext = '.' + ext; - this.engines[ext] = fn; - return this; -}; - -/** - * Map the given param placeholder `name`(s) to the given callback(s). - * - * Parameter mapping is used to provide pre-conditions to routes - * which use normalized placeholders. For example a _:user_id_ parameter - * could automatically load a user's information from the database without - * any additional code, - * - * The callback uses the same signature as middleware, the only difference - * being that the value of the placeholder is passed, in this case the _id_ - * of the user. Once the `next()` function is invoked, just like middleware - * it will continue on to execute the route, or subsequent parameter functions. - * - * app.param('user_id', function(req, res, next, id){ - * User.find(id, function(err, user){ - * if (err) { - * next(err); - * } else if (user) { - * req.user = user; - * next(); - * } else { - * next(new Error('failed to load user')); - * } - * }); - * }); - * - * @param {String|Array} name - * @param {Function} fn - * @return {app} for chaining - * @api public - */ - -app.param = function(name, fn){ - var self = this - , fns = [].slice.call(arguments, 1); - - // array - if (Array.isArray(name)) { - name.forEach(function(name){ - fns.forEach(function(fn){ - self.param(name, fn); - }); - }); - // param logic - } else if ('function' == typeof name) { - this._router.param(name); - // single - } else { - if (':' == name[0]) name = name.substr(1); - fns.forEach(function(fn){ - self._router.param(name, fn); - }); - } - - return this; -}; - -/** - * Assign `setting` to `val`, or return `setting`'s value. - * - * app.set('foo', 'bar'); - * app.get('foo'); - * // => "bar" - * - * Mounted servers inherit their parent server's settings. - * - * @param {String} setting - * @param {String} val - * @return {Server} for chaining - * @api public - */ - -app.set = function(setting, val){ - if (1 == arguments.length) { - return this.settings[setting]; - } else { - this.settings[setting] = val; - return this; - } -}; - -/** - * Return the app's absolute pathname - * based on the parent(s) that have - * mounted it. - * - * For example if the application was - * mounted as "/admin", which itself - * was mounted as "/blog" then the - * return value would be "/blog/admin". - * - * @return {String} - * @api private - */ - -app.path = function(){ - return this.parent - ? this.parent.path() + this.route - : ''; -}; - -/** - * Check if `setting` is enabled (truthy). - * - * app.enabled('foo') - * // => false - * - * app.enable('foo') - * app.enabled('foo') - * // => true - * - * @param {String} setting - * @return {Boolean} - * @api public - */ - -app.enabled = function(setting){ - return !!this.set(setting); -}; - -/** - * Check if `setting` is disabled. - * - * app.disabled('foo') - * // => true - * - * app.enable('foo') - * app.disabled('foo') - * // => false - * - * @param {String} setting - * @return {Boolean} - * @api public - */ - -app.disabled = function(setting){ - return !this.set(setting); -}; - -/** - * Enable `setting`. - * - * @param {String} setting - * @return {app} for chaining - * @api public - */ - -app.enable = function(setting){ - return this.set(setting, true); -}; - -/** - * Disable `setting`. - * - * @param {String} setting - * @return {app} for chaining - * @api public - */ - -app.disable = function(setting){ - return this.set(setting, false); -}; - -/** - * Configure callback for zero or more envs, - * when no `env` is specified that callback will - * be invoked for all environments. Any combination - * can be used multiple times, in any order desired. - * - * Examples: - * - * app.configure(function(){ - * // executed for all envs - * }); - * - * app.configure('stage', function(){ - * // executed staging env - * }); - * - * app.configure('stage', 'production', function(){ - * // executed for stage and production - * }); - * - * Note: - * - * These callbacks are invoked immediately, and - * are effectively sugar for the following: - * - * var env = process.env.NODE_ENV || 'development'; - * - * switch (env) { - * case 'development': - * ... - * break; - * case 'stage': - * ... - * break; - * case 'production': - * ... - * break; - * } - * - * @param {String} env... - * @param {Function} fn - * @return {app} for chaining - * @api public - */ - -app.configure = function(env, fn){ - var envs = 'all' - , args = [].slice.call(arguments); - fn = args.pop(); - if (args.length) envs = args; - if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this); - return this; -}; - -/** - * Delegate `.VERB(...)` calls to `router.VERB(...)`. - */ - -methods.forEach(function(method){ - app[method] = function(path){ - if ('get' == method && 1 == arguments.length) return this.set(path); - - // deprecated - if (Array.isArray(path)) { - console.trace('passing an array to app.VERB() is deprecated and will be removed in 4.0'); - } - - // if no router attached yet, attach the router - if (!this._usedRouter) this.use(this.router); - - // setup route - this._router[method].apply(this._router, arguments); - return this; - }; -}); - -/** - * Special-cased "all" method, applying the given route `path`, - * middleware, and callback to _every_ HTTP method. - * - * @param {String} path - * @param {Function} ... - * @return {app} for chaining - * @api public - */ - -app.all = function(path){ - var args = arguments; - methods.forEach(function(method){ - app[method].apply(this, args); - }, this); - return this; -}; - -// del -> delete alias - -app.del = app.delete; - -/** - * Render the given view `name` name with `options` - * and a callback accepting an error and the - * rendered template string. - * - * Example: - * - * app.render('email', { name: 'Tobi' }, function(err, html){ - * // ... - * }) - * - * @param {String} name - * @param {String|Function} options or fn - * @param {Function} fn - * @api public - */ - -app.render = function(name, options, fn){ - var opts = {} - , cache = this.cache - , engines = this.engines - , view; - - // support callback function as second arg - if ('function' == typeof options) { - fn = options, options = {}; - } - - // merge app.locals - utils.merge(opts, this.locals); - - // merge options._locals - if (options._locals) utils.merge(opts, options._locals); - - // merge options - utils.merge(opts, options); - - // set .cache unless explicitly provided - opts.cache = null == opts.cache - ? this.enabled('view cache') - : opts.cache; - - // primed cache - if (opts.cache) view = cache[name]; - - // view - if (!view) { - view = new (this.get('view'))(name, { - defaultEngine: this.get('view engine'), - root: this.get('views'), - engines: engines - }); - - if (!view.path) { - var err = new Error('Failed to lookup view "' + name + '" in views directory "' + view.root + '"'); - err.view = view; - return fn(err); - } - - // prime the cache - if (opts.cache) cache[name] = view; - } - - // render - try { - view.render(opts, fn); - } catch (err) { - fn(err); - } -}; - -/** - * Listen for connections. - * - * A node `http.Server` is returned, with this - * application (which is a `Function`) as its - * callback. If you wish to create both an HTTP - * and HTTPS server you may do so with the "http" - * and "https" modules as shown here: - * - * var http = require('http') - * , https = require('https') - * , express = require('express') - * , app = express(); - * - * http.createServer(app).listen(80); - * https.createServer({ ... }, app).listen(443); - * - * @return {http.Server} - * @api public - */ - -app.listen = function(){ - var server = http.createServer(this); - return server.listen.apply(server, arguments); -}; diff --git a/realtime/node_modules/express/lib/express.js b/realtime/node_modules/express/lib/express.js deleted file mode 100644 index 4f61cdbd..00000000 --- a/realtime/node_modules/express/lib/express.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Module dependencies. - */ - -var merge = require('merge-descriptors'); -var connect = require('connect') - , proto = require('./application') - , Route = require('./router/route') - , Router = require('./router') - , req = require('./request') - , res = require('./response') - , utils = connect.utils; - -/** - * Expose `createApplication()`. - */ - -exports = module.exports = createApplication; - -/** - * Expose mime. - */ - -exports.mime = connect.mime; - -/** - * Create an express application. - * - * @return {Function} - * @api public - */ - -function createApplication() { - var app = connect(); - utils.merge(app, proto); - app.request = { __proto__: req, app: app }; - app.response = { __proto__: res, app: app }; - app.init(); - return app; -} - -/** - * Expose connect.middleware as express.* - * for example `express.logger` etc. - */ - -merge(exports, connect.middleware); - -/** - * Error on createServer(). - */ - -exports.createServer = function(){ - console.warn('Warning: express.createServer() is deprecated, express'); - console.warn('applications no longer inherit from http.Server,'); - console.warn('please use:'); - console.warn(''); - console.warn(' var express = require("express");'); - console.warn(' var app = express();'); - console.warn(''); - return createApplication(); -}; - -/** - * Expose the prototypes. - */ - -exports.application = proto; -exports.request = req; -exports.response = res; - -/** - * Expose constructors. - */ - -exports.Route = Route; -exports.Router = Router; - -// Error handler title - -exports.errorHandler.title = 'Express'; - diff --git a/realtime/node_modules/express/lib/middleware.js b/realtime/node_modules/express/lib/middleware.js deleted file mode 100644 index e07dd4cd..00000000 --- a/realtime/node_modules/express/lib/middleware.js +++ /dev/null @@ -1,32 +0,0 @@ - -/** - * Module dependencies. - */ - -var utils = require('./utils'); - -/** - * Initialization middleware, exposing the - * request and response to eachother, as well - * as defaulting the X-Powered-By header field. - * - * @param {Function} app - * @return {Function} - * @api private - */ - -exports.init = function(app){ - return function expressInit(req, res, next){ - if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); - req.res = res; - res.req = req; - req.next = next; - - req.__proto__ = app.request; - res.__proto__ = app.response; - - res.locals = res.locals || utils.locals(res); - - next(); - } -}; diff --git a/realtime/node_modules/express/lib/request.js b/realtime/node_modules/express/lib/request.js deleted file mode 100644 index 3d41617e..00000000 --- a/realtime/node_modules/express/lib/request.js +++ /dev/null @@ -1,529 +0,0 @@ - -/** - * Module dependencies. - */ - -var http = require('http') - , utils = require('./utils') - , connect = require('connect') - , fresh = require('fresh') - , parseRange = require('range-parser') - , parse = connect.utils.parseUrl - , mime = connect.mime; - -/** - * Request prototype. - */ - -var req = exports = module.exports = { - __proto__: http.IncomingMessage.prototype -}; - -/** - * Return request header. - * - * The `Referrer` header field is special-cased, - * both `Referrer` and `Referer` are interchangeable. - * - * Examples: - * - * req.get('Content-Type'); - * // => "text/plain" - * - * req.get('content-type'); - * // => "text/plain" - * - * req.get('Something'); - * // => undefined - * - * Aliased as `req.header()`. - * - * @param {String} name - * @return {String} - * @api public - */ - -req.get = -req.header = function(name){ - switch (name = name.toLowerCase()) { - case 'referer': - case 'referrer': - return this.headers.referrer - || this.headers.referer; - default: - return this.headers[name]; - } -}; - -/** - * Check if the given `type(s)` is acceptable, returning - * the best match when true, otherwise `undefined`, in which - * case you should respond with 406 "Not Acceptable". - * - * The `type` value may be a single mime type string - * such as "application/json", the extension name - * such as "json", a comma-delimted list such as "json, html, text/plain", - * an argument list such as `"json", "html", "text/plain"`, - * or an array `["json", "html", "text/plain"]`. When a list - * or array is given the _best_ match, if any is returned. - * - * Examples: - * - * // Accept: text/html - * req.accepts('html'); - * // => "html" - * - * // Accept: text/*, application/json - * req.accepts('html'); - * // => "html" - * req.accepts('text/html'); - * // => "text/html" - * req.accepts('json, text'); - * // => "json" - * req.accepts('application/json'); - * // => "application/json" - * - * // Accept: text/*, application/json - * req.accepts('image/png'); - * req.accepts('png'); - * // => undefined - * - * // Accept: text/*;q=.5, application/json - * req.accepts(['html', 'json']); - * req.accepts('html', 'json'); - * req.accepts('html, json'); - * // => "json" - * - * @param {String|Array} type(s) - * @return {String} - * @api public - */ - -req.accepts = function(type){ - var args = arguments.length > 1 ? [].slice.apply(arguments) : type; - return utils.accepts(args, this.get('Accept')); -}; - -/** - * Check if the given `encoding` is accepted. - * - * @param {String} encoding - * @return {Boolean} - * @api public - */ - -req.acceptsEncoding = function(encoding){ - return !! ~this.acceptedEncodings.indexOf(encoding); -}; - -/** - * Check if the given `charset` is acceptable, - * otherwise you should respond with 406 "Not Acceptable". - * - * @param {String} charset - * @return {Boolean} - * @api public - */ - -req.acceptsCharset = function(charset){ - var accepted = this.acceptedCharsets; - return accepted.length - ? !! ~accepted.indexOf(charset) - : true; -}; - -/** - * Check if the given `lang` is acceptable, - * otherwise you should respond with 406 "Not Acceptable". - * - * @param {String} lang - * @return {Boolean} - * @api public - */ - -req.acceptsLanguage = function(lang){ - var accepted = this.acceptedLanguages; - return accepted.length - ? !! ~accepted.indexOf(lang) - : true; -}; - -/** - * Parse Range header field, - * capping to the given `size`. - * - * Unspecified ranges such as "0-" require - * knowledge of your resource length. In - * the case of a byte range this is of course - * the total number of bytes. If the Range - * header field is not given `null` is returned, - * `-1` when unsatisfiable, `-2` when syntactically invalid. - * - * NOTE: remember that ranges are inclusive, so - * for example "Range: users=0-3" should respond - * with 4 users when available, not 3. - * - * @param {Number} size - * @return {Array} - * @api public - */ - -req.range = function(size){ - var range = this.get('Range'); - if (!range) return; - return parseRange(size, range); -}; - -/** - * Return an array of encodings. - * - * Examples: - * - * ['gzip', 'deflate'] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('acceptedEncodings', function(){ - var accept = this.get('Accept-Encoding'); - return accept - ? accept.trim().split(/ *, */) - : []; -}); - -/** - * Return an array of Accepted media types - * ordered from highest quality to lowest. - * - * Examples: - * - * [ { value: 'application/json', - * quality: 1, - * type: 'application', - * subtype: 'json' }, - * { value: 'text/html', - * quality: 0.5, - * type: 'text', - * subtype: 'html' } ] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('accepted', function(){ - var accept = this.get('Accept'); - return accept - ? utils.parseAccept(accept) - : []; -}); - -/** - * Return an array of Accepted languages - * ordered from highest quality to lowest. - * - * Examples: - * - * Accept-Language: en;q=.5, en-us - * ['en-us', 'en'] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('acceptedLanguages', function(){ - var accept = this.get('Accept-Language'); - return accept - ? utils - .parseParams(accept) - .map(function(obj){ - return obj.value; - }) - : []; -}); - -/** - * Return an array of Accepted charsets - * ordered from highest quality to lowest. - * - * Examples: - * - * Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8 - * ['unicode-1-1', 'iso-8859-5'] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('acceptedCharsets', function(){ - var accept = this.get('Accept-Charset'); - return accept - ? utils - .parseParams(accept) - .map(function(obj){ - return obj.value; - }) - : []; -}); - -/** - * Return the value of param `name` when present or `defaultValue`. - * - * - Checks route placeholders, ex: _/user/:id_ - * - Checks body params, ex: id=12, {"id":12} - * - Checks query string params, ex: ?id=12 - * - * To utilize request bodies, `req.body` - * should be an object. This can be done by using - * the `connect.bodyParser()` middleware. - * - * @param {String} name - * @param {Mixed} [defaultValue] - * @return {String} - * @api public - */ - -req.param = function(name, defaultValue){ - var params = this.params || {}; - var body = this.body || {}; - var query = this.query || {}; - if (null != params[name] && params.hasOwnProperty(name)) return params[name]; - if (null != body[name]) return body[name]; - if (null != query[name]) return query[name]; - return defaultValue; -}; - -/** - * Check if the incoming request contains the "Content-Type" - * header field, and it contains the give mime `type`. - * - * Examples: - * - * // With Content-Type: text/html; charset=utf-8 - * req.is('html'); - * req.is('text/html'); - * req.is('text/*'); - * // => true - * - * // When Content-Type is application/json - * req.is('json'); - * req.is('application/json'); - * req.is('application/*'); - * // => true - * - * req.is('html'); - * // => false - * - * @param {String} type - * @return {Boolean} - * @api public - */ - -req.is = function(type){ - var ct = this.get('Content-Type'); - if (!ct) return false; - ct = ct.split(';')[0]; - if (!~type.indexOf('/')) type = mime.lookup(type); - if (~type.indexOf('*')) { - type = type.split('/'); - ct = ct.split('/'); - if ('*' == type[0] && type[1] == ct[1]) return true; - if ('*' == type[1] && type[0] == ct[0]) return true; - return false; - } - return !! ~ct.indexOf(type); -}; - -/** - * Return the protocol string "http" or "https" - * when requested with TLS. When the "trust proxy" - * setting is enabled the "X-Forwarded-Proto" header - * field will be trusted. If you're running behind - * a reverse proxy that supplies https for you this - * may be enabled. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('protocol', function(){ - var trustProxy = this.app.get('trust proxy'); - if (this.connection.encrypted) return 'https'; - if (!trustProxy) return 'http'; - var proto = this.get('X-Forwarded-Proto') || 'http'; - return proto.split(/\s*,\s*/)[0]; -}); - -/** - * Short-hand for: - * - * req.protocol == 'https' - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('secure', function(){ - return 'https' == this.protocol; -}); - -/** - * Return the remote address, or when - * "trust proxy" is `true` return - * the upstream addr. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('ip', function(){ - return this.ips[0] || this.connection.remoteAddress; -}); - -/** - * When "trust proxy" is `true`, parse - * the "X-Forwarded-For" ip address list. - * - * For example if the value were "client, proxy1, proxy2" - * you would receive the array `["client", "proxy1", "proxy2"]` - * where "proxy2" is the furthest down-stream. - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('ips', function(){ - var trustProxy = this.app.get('trust proxy'); - var val = this.get('X-Forwarded-For'); - return trustProxy && val - ? val.split(/ *, */) - : []; -}); - -/** - * Return basic auth credentials. - * - * Examples: - * - * // http://tobi:hello@example.com - * req.auth - * // => { username: 'tobi', password: 'hello' } - * - * @return {Object} or undefined - * @api public - */ - -req.__defineGetter__('auth', function(){ - // missing - var auth = this.get('Authorization'); - if (!auth) return; - - // malformed - var parts = auth.split(' '); - if ('basic' != parts[0].toLowerCase()) return; - if (!parts[1]) return; - auth = parts[1]; - - // credentials - auth = new Buffer(auth, 'base64').toString().match(/^([^:]*):(.*)$/); - if (!auth) return; - return { username: auth[1], password: auth[2] }; -}); - -/** - * Return subdomains as an array. - * - * Subdomains are the dot-separated parts of the host before the main domain of - * the app. By default, the domain of the app is assumed to be the last two - * parts of the host. This can be changed by setting "subdomain offset". - * - * For example, if the domain is "tobi.ferrets.example.com": - * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. - * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('subdomains', function(){ - var offset = this.app.get('subdomain offset'); - return (this.host || '') - .split('.') - .reverse() - .slice(offset); -}); - -/** - * Short-hand for `url.parse(req.url).pathname`. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('path', function(){ - return parse(this).pathname; -}); - -/** - * Parse the "Host" header field hostname. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('host', function(){ - var trustProxy = this.app.get('trust proxy'); - var host = trustProxy && this.get('X-Forwarded-Host'); - host = host || this.get('Host'); - if (!host) return; - return host.split(':')[0]; -}); - -/** - * Check if the request is fresh, aka - * Last-Modified and/or the ETag - * still match. - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('fresh', function(){ - var method = this.method; - var s = this.res.statusCode; - - // GET or HEAD for weak freshness validation only - if ('GET' != method && 'HEAD' != method) return false; - - // 2xx or 304 as per rfc2616 14.26 - if ((s >= 200 && s < 300) || 304 == s) { - return fresh(this.headers, this.res._headers); - } - - return false; -}); - -/** - * Check if the request is stale, aka - * "Last-Modified" and / or the "ETag" for the - * resource has changed. - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('stale', function(){ - return !this.fresh; -}); - -/** - * Check if the request was an _XMLHttpRequest_. - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('xhr', function(){ - var val = this.get('X-Requested-With') || ''; - return 'xmlhttprequest' == val.toLowerCase(); -}); diff --git a/realtime/node_modules/express/lib/response.js b/realtime/node_modules/express/lib/response.js deleted file mode 100644 index 31c79c0d..00000000 --- a/realtime/node_modules/express/lib/response.js +++ /dev/null @@ -1,799 +0,0 @@ -/** - * Module dependencies. - */ - -var http = require('http') - , path = require('path') - , connect = require('connect') - , utils = connect.utils - , sign = require('cookie-signature').sign - , normalizeType = require('./utils').normalizeType - , normalizeTypes = require('./utils').normalizeTypes - , etag = require('./utils').etag - , statusCodes = http.STATUS_CODES - , cookie = require('cookie') - , send = require('send') - , mime = connect.mime - , resolve = require('url').resolve - , basename = path.basename - , extname = path.extname; - -/** - * Response prototype. - */ - -var res = module.exports = { - __proto__: http.ServerResponse.prototype -}; - -/** - * Set status `code`. - * - * @param {Number} code - * @return {ServerResponse} - * @api public - */ - -res.status = function(code){ - this.statusCode = code; - return this; -}; - -/** - * Set Link header field with the given `links`. - * - * Examples: - * - * res.links({ - * next: 'http://api.example.com/users?page=2', - * last: 'http://api.example.com/users?page=5' - * }); - * - * @param {Object} links - * @return {ServerResponse} - * @api public - */ - -res.links = function(links){ - var link = this.get('Link') || ''; - if (link) link += ', '; - return this.set('Link', link + Object.keys(links).map(function(rel){ - return '<' + links[rel] + '>; rel="' + rel + '"'; - }).join(', ')); -}; - -/** - * Send a response. - * - * Examples: - * - * res.send(new Buffer('wahoo')); - * res.send({ some: 'json' }); - * res.send('

some html

'); - * res.send(404, 'Sorry, cant find that'); - * res.send(404); - * - * @param {Mixed} body or status - * @param {Mixed} body - * @return {ServerResponse} - * @api public - */ - -res.send = function(body){ - var req = this.req; - var head = 'HEAD' == req.method; - var len; - - // settings - var app = this.app; - - // allow status / body - if (2 == arguments.length) { - // res.send(body, status) backwards compat - if ('number' != typeof body && 'number' == typeof arguments[1]) { - this.statusCode = arguments[1]; - } else { - this.statusCode = body; - body = arguments[1]; - } - } - - switch (typeof body) { - // response status - case 'number': - this.get('Content-Type') || this.type('txt'); - this.statusCode = body; - body = http.STATUS_CODES[body]; - break; - // string defaulting to html - case 'string': - if (!this.get('Content-Type')) { - this.charset = this.charset || 'utf-8'; - this.type('html'); - } - break; - case 'boolean': - case 'object': - if (null == body) { - body = ''; - } else if (Buffer.isBuffer(body)) { - this.get('Content-Type') || this.type('bin'); - } else { - return this.json(body); - } - break; - } - - // populate Content-Length - if (undefined !== body && !this.get('Content-Length')) { - this.set('Content-Length', len = Buffer.isBuffer(body) - ? body.length - : Buffer.byteLength(body)); - } - - // ETag support - // TODO: W/ support - if (app.settings.etag && len && 'GET' == req.method) { - if (!this.get('ETag')) { - this.set('ETag', etag(body)); - } - } - - // freshness - if (req.fresh) this.statusCode = 304; - - // strip irrelevant headers - if (204 == this.statusCode || 304 == this.statusCode) { - this.removeHeader('Content-Type'); - this.removeHeader('Content-Length'); - this.removeHeader('Transfer-Encoding'); - body = ''; - } - - // respond - this.end(head ? null : body); - return this; -}; - -/** - * Send JSON response. - * - * Examples: - * - * res.json(null); - * res.json({ user: 'tj' }); - * res.json(500, 'oh noes!'); - * res.json(404, 'I dont have that'); - * - * @param {Mixed} obj or status - * @param {Mixed} obj - * @return {ServerResponse} - * @api public - */ - -res.json = function(obj){ - // allow status / body - if (2 == arguments.length) { - // res.json(body, status) backwards compat - if ('number' == typeof arguments[1]) { - this.statusCode = arguments[1]; - } else { - this.statusCode = obj; - obj = arguments[1]; - } - } - - // settings - var app = this.app; - var replacer = app.get('json replacer'); - var spaces = app.get('json spaces'); - var body = JSON.stringify(obj, replacer, spaces); - - // content-type - this.charset = this.charset || 'utf-8'; - this.get('Content-Type') || this.set('Content-Type', 'application/json'); - - return this.send(body); -}; - -/** - * Send JSON response with JSONP callback support. - * - * Examples: - * - * res.jsonp(null); - * res.jsonp({ user: 'tj' }); - * res.jsonp(500, 'oh noes!'); - * res.jsonp(404, 'I dont have that'); - * - * @param {Mixed} obj or status - * @param {Mixed} obj - * @return {ServerResponse} - * @api public - */ - -res.jsonp = function(obj){ - // allow status / body - if (2 == arguments.length) { - // res.json(body, status) backwards compat - if ('number' == typeof arguments[1]) { - this.statusCode = arguments[1]; - } else { - this.statusCode = obj; - obj = arguments[1]; - } - } - - // settings - var app = this.app; - var replacer = app.get('json replacer'); - var spaces = app.get('json spaces'); - var body = JSON.stringify(obj, replacer, spaces) - .replace(/\u2028/g, '\\u2028') - .replace(/\u2029/g, '\\u2029'); - var callback = this.req.query[app.get('jsonp callback name')]; - - // content-type - this.charset = this.charset || 'utf-8'; - this.set('Content-Type', 'application/json'); - - // jsonp - if (callback) { - if (Array.isArray(callback)) callback = callback[0]; - this.set('Content-Type', 'text/javascript'); - var cb = callback.replace(/[^\[\]\w$.]/g, ''); - body = 'typeof ' + cb + ' === \'function\' && ' + cb + '(' + body + ');'; - } - - return this.send(body); -}; - -/** - * Transfer the file at the given `path`. - * - * Automatically sets the _Content-Type_ response header field. - * The callback `fn(err)` is invoked when the transfer is complete - * or when an error occurs. Be sure to check `res.sentHeader` - * if you wish to attempt responding, as the header and some data - * may have already been transferred. - * - * Options: - * - * - `maxAge` defaulting to 0 - * - `root` root directory for relative filenames - * - * Examples: - * - * The following example illustrates how `res.sendfile()` may - * be used as an alternative for the `static()` middleware for - * dynamic situations. The code backing `res.sendfile()` is actually - * the same code, so HTTP cache support etc is identical. - * - * app.get('/user/:uid/photos/:file', function(req, res){ - * var uid = req.params.uid - * , file = req.params.file; - * - * req.user.mayViewFilesFrom(uid, function(yes){ - * if (yes) { - * res.sendfile('/uploads/' + uid + '/' + file); - * } else { - * res.send(403, 'Sorry! you cant see that.'); - * } - * }); - * }); - * - * @param {String} path - * @param {Object|Function} options or fn - * @param {Function} fn - * @api public - */ - -res.sendfile = function(path, options, fn){ - var self = this - , req = self.req - , next = this.req.next - , options = options || {} - , done; - - // support function as second arg - if ('function' == typeof options) { - fn = options; - options = {}; - } - - // socket errors - req.socket.on('error', error); - - // errors - function error(err) { - if (done) return; - done = true; - - // clean up - cleanup(); - if (!self.headerSent) self.removeHeader('Content-Disposition'); - - // callback available - if (fn) return fn(err); - - // list in limbo if there's no callback - if (self.headerSent) return; - - // delegate - next(err); - } - - // streaming - function stream(stream) { - if (done) return; - cleanup(); - if (fn) stream.on('end', fn); - } - - // cleanup - function cleanup() { - req.socket.removeListener('error', error); - } - - // transfer - var file = send(req, path); - if (options.root) file.root(options.root); - file.maxage(options.maxAge || 0); - file.on('error', error); - file.on('directory', next); - file.on('stream', stream); - file.pipe(this); - this.on('finish', cleanup); -}; - -/** - * Transfer the file at the given `path` as an attachment. - * - * Optionally providing an alternate attachment `filename`, - * and optional callback `fn(err)`. The callback is invoked - * when the data transfer is complete, or when an error has - * ocurred. Be sure to check `res.headerSent` if you plan to respond. - * - * This method uses `res.sendfile()`. - * - * @param {String} path - * @param {String|Function} filename or fn - * @param {Function} fn - * @api public - */ - -res.download = function(path, filename, fn){ - // support function as second arg - if ('function' == typeof filename) { - fn = filename; - filename = null; - } - - filename = filename || path; - this.set('Content-Disposition', 'attachment; filename="' + basename(filename) + '"'); - return this.sendfile(path, fn); -}; - -/** - * Set _Content-Type_ response header with `type` through `mime.lookup()` - * when it does not contain "/", or set the Content-Type to `type` otherwise. - * - * Examples: - * - * res.type('.html'); - * res.type('html'); - * res.type('json'); - * res.type('application/json'); - * res.type('png'); - * - * @param {String} type - * @return {ServerResponse} for chaining - * @api public - */ - -res.contentType = -res.type = function(type){ - return this.set('Content-Type', ~type.indexOf('/') - ? type - : mime.lookup(type)); -}; - -/** - * Respond to the Acceptable formats using an `obj` - * of mime-type callbacks. - * - * This method uses `req.accepted`, an array of - * acceptable types ordered by their quality values. - * When "Accept" is not present the _first_ callback - * is invoked, otherwise the first match is used. When - * no match is performed the server responds with - * 406 "Not Acceptable". - * - * Content-Type is set for you, however if you choose - * you may alter this within the callback using `res.type()` - * or `res.set('Content-Type', ...)`. - * - * res.format({ - * 'text/plain': function(){ - * res.send('hey'); - * }, - * - * 'text/html': function(){ - * res.send('

hey

'); - * }, - * - * 'appliation/json': function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * In addition to canonicalized MIME types you may - * also use extnames mapped to these types: - * - * res.format({ - * text: function(){ - * res.send('hey'); - * }, - * - * html: function(){ - * res.send('

hey

'); - * }, - * - * json: function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * By default Express passes an `Error` - * with a `.status` of 406 to `next(err)` - * if a match is not made. If you provide - * a `.default` callback it will be invoked - * instead. - * - * @param {Object} obj - * @return {ServerResponse} for chaining - * @api public - */ - -res.format = function(obj){ - var req = this.req - , next = req.next; - - var fn = obj.default; - if (fn) delete obj.default; - var keys = Object.keys(obj); - - var key = req.accepts(keys); - - this.vary("Accept"); - - if (key) { - var type = normalizeType(key).value; - var charset = mime.charsets.lookup(type); - if (charset) type += '; charset=' + charset; - this.set('Content-Type', type); - obj[key](req, this, next); - } else if (fn) { - fn(); - } else { - var err = new Error('Not Acceptable'); - err.status = 406; - err.types = normalizeTypes(keys).map(function(o){ return o.value }); - next(err); - } - - return this; -}; - -/** - * Set _Content-Disposition_ header to _attachment_ with optional `filename`. - * - * @param {String} filename - * @return {ServerResponse} - * @api public - */ - -res.attachment = function(filename){ - if (filename) this.type(extname(filename)); - this.set('Content-Disposition', filename - ? 'attachment; filename="' + basename(filename) + '"' - : 'attachment'); - return this; -}; - -/** - * Set header `field` to `val`, or pass - * an object of header fields. - * - * Examples: - * - * res.set('Foo', ['bar', 'baz']); - * res.set('Accept', 'application/json'); - * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); - * - * Aliased as `res.header()`. - * - * @param {String|Object|Array} field - * @param {String} val - * @return {ServerResponse} for chaining - * @api public - */ - -res.set = -res.header = function(field, val){ - if (2 == arguments.length) { - if (Array.isArray(val)) val = val.map(String); - else val = String(val); - this.setHeader(field, val); - } else { - for (var key in field) { - this.set(key, field[key]); - } - } - return this; -}; - -/** - * Get value for header `field`. - * - * @param {String} field - * @return {String} - * @api public - */ - -res.get = function(field){ - return this.getHeader(field); -}; - -/** - * Clear cookie `name`. - * - * @param {String} name - * @param {Object} options - * @param {ServerResponse} for chaining - * @api public - */ - -res.clearCookie = function(name, options){ - var opts = { expires: new Date(1), path: '/' }; - return this.cookie(name, '', options - ? utils.merge(opts, options) - : opts); -}; - -/** - * Set cookie `name` to `val`, with the given `options`. - * - * Options: - * - * - `maxAge` max-age in milliseconds, converted to `expires` - * - `signed` sign the cookie - * - `path` defaults to "/" - * - * Examples: - * - * // "Remember Me" for 15 minutes - * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); - * - * // save as above - * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) - * - * @param {String} name - * @param {String|Object} val - * @param {Options} options - * @api public - */ - -res.cookie = function(name, val, options){ - options = utils.merge({}, options); - var secret = this.req.secret; - var signed = options.signed; - if (signed && !secret) throw new Error('connect.cookieParser("secret") required for signed cookies'); - if ('number' == typeof val) val = val.toString(); - if ('object' == typeof val) val = 'j:' + JSON.stringify(val); - if (signed) val = 's:' + sign(val, secret); - if ('maxAge' in options) { - options.expires = new Date(Date.now() + options.maxAge); - options.maxAge /= 1000; - } - if (null == options.path) options.path = '/'; - this.set('Set-Cookie', cookie.serialize(name, String(val), options)); - return this; -}; - - -/** - * Set the location header to `url`. - * - * The given `url` can also be "back", which redirects - * to the _Referrer_ or _Referer_ headers or "/". - * - * Examples: - * - * res.location('/foo/bar').; - * res.location('http://example.com'); - * res.location('../login'); // /blog/post/1 -> /blog/login - * - * Mounting: - * - * When an application is mounted and `res.location()` - * is given a path that does _not_ lead with "/" it becomes - * relative to the mount-point. For example if the application - * is mounted at "/blog", the following would become "/blog/login". - * - * res.location('login'); - * - * While the leading slash would result in a location of "/login": - * - * res.location('/login'); - * - * @param {String} url - * @api public - */ - -res.location = function(url){ - var app = this.app - , req = this.req - , path; - - // "back" is an alias for the referrer - if ('back' == url) url = req.get('Referrer') || '/'; - - // relative - if (!~url.indexOf('://') && 0 != url.indexOf('//')) { - // relative to path - if ('.' == url[0]) { - path = req.originalUrl.split('?')[0]; - path = path + ('/' == path[path.length - 1] ? '' : '/'); - url = resolve(path, url); - // relative to mount-point - } else if ('/' != url[0]) { - path = app.path(); - url = path + '/' + url; - } - } - - // Respond - this.set('Location', url); - return this; -}; - -/** - * Redirect to the given `url` with optional response `status` - * defaulting to 302. - * - * The resulting `url` is determined by `res.location()`, so - * it will play nicely with mounted apps, relative paths, - * `"back"` etc. - * - * Examples: - * - * res.redirect('/foo/bar'); - * res.redirect('http://example.com'); - * res.redirect(301, 'http://example.com'); - * res.redirect('http://example.com', 301); - * res.redirect('../login'); // /blog/post/1 -> /blog/login - * - * @param {String} url - * @param {Number} code - * @api public - */ - -res.redirect = function(url){ - var head = 'HEAD' == this.req.method - , status = 302 - , body; - - // allow status / url - if (2 == arguments.length) { - if ('number' == typeof url) { - status = url; - url = arguments[1]; - } else { - status = arguments[1]; - } - } - - // Set location header - this.location(url); - url = this.get('Location'); - - // Support text/{plain,html} by default - this.format({ - text: function(){ - body = statusCodes[status] + '. Redirecting to ' + encodeURI(url); - }, - - html: function(){ - var u = utils.escape(url); - body = '

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

'; - }, - - default: function(){ - body = ''; - } - }); - - // Respond - this.statusCode = status; - this.set('Content-Length', Buffer.byteLength(body)); - this.end(head ? null : body); -}; - -/** - * Add `field` to Vary. If already present in the Vary set, then - * this call is simply ignored. - * - * @param {Array|String} field - * @param {ServerResponse} for chaining - * @api public - */ - -res.vary = function(field){ - var self = this; - - // nothing - if (!field) return this; - - // array - if (Array.isArray(field)) { - field.forEach(function(field){ - self.vary(field); - }); - return; - } - - var vary = this.get('Vary'); - - // append - if (vary) { - vary = vary.split(/ *, */); - if (!~vary.indexOf(field)) vary.push(field); - this.set('Vary', vary.join(', ')); - return this; - } - - // set - this.set('Vary', field); - return this; -}; - -/** - * Render `view` with the given `options` and optional callback `fn`. - * When a callback function is given a response will _not_ be made - * automatically, otherwise a response of _200_ and _text/html_ is given. - * - * Options: - * - * - `cache` boolean hinting to the engine it should cache - * - `filename` filename of the view being rendered - * - * @param {String} view - * @param {Object|Function} options or callback function - * @param {Function} fn - * @api public - */ - -res.render = function(view, options, fn){ - var self = this - , options = options || {} - , req = this.req - , app = req.app; - - // support callback function as second arg - if ('function' == typeof options) { - fn = options, options = {}; - } - - // merge res.locals - options._locals = self.locals; - - // default callback to respond - fn = fn || function(err, str){ - if (err) return req.next(err); - self.send(str); - }; - - // render - app.render(view, options, fn); -}; diff --git a/realtime/node_modules/express/lib/router/index.js b/realtime/node_modules/express/lib/router/index.js deleted file mode 100644 index cd2f2693..00000000 --- a/realtime/node_modules/express/lib/router/index.js +++ /dev/null @@ -1,321 +0,0 @@ -/** - * Module dependencies. - */ - -var Route = require('./route') - , utils = require('../utils') - , methods = require('methods') - , debug = require('debug')('express:router') - , parse = require('connect').utils.parseUrl; - -/** - * Expose `Router` constructor. - */ - -exports = module.exports = Router; - -/** - * Initialize a new `Router` with the given `options`. - * - * @param {Object} options - * @api private - */ - -function Router(options) { - options = options || {}; - var self = this; - this.map = {}; - this.params = {}; - this._params = []; - this.caseSensitive = options.caseSensitive; - this.strict = options.strict; - this.middleware = function router(req, res, next){ - self._dispatch(req, res, next); - }; -} - -/** - * Register a param callback `fn` for the given `name`. - * - * @param {String|Function} name - * @param {Function} fn - * @return {Router} for chaining - * @api public - */ - -Router.prototype.param = function(name, fn){ - // param logic - if ('function' == typeof name) { - this._params.push(name); - return; - } - - // apply param functions - var params = this._params - , len = params.length - , ret; - - for (var i = 0; i < len; ++i) { - if (ret = params[i](name, fn)) { - fn = ret; - } - } - - // ensure we end up with a - // middleware function - if ('function' != typeof fn) { - throw new Error('invalid param() call for ' + name + ', got ' + fn); - } - - (this.params[name] = this.params[name] || []).push(fn); - return this; -}; - -/** - * Route dispatcher aka the route "middleware". - * - * @param {IncomingMessage} req - * @param {ServerResponse} res - * @param {Function} next - * @api private - */ - -Router.prototype._dispatch = function(req, res, next){ - var params = this.params - , self = this; - - debug('dispatching %s %s (%s)', req.method, req.url, req.originalUrl); - - // route dispatch - (function pass(i, err){ - var paramCallbacks - , paramIndex = 0 - , paramVal - , route - , keys - , key; - - // match next route - function nextRoute(err) { - pass(req._route_index + 1, err); - } - - // match route - req.route = route = self.matchRequest(req, i); - - // implied OPTIONS - if (!route && 'OPTIONS' == req.method) return self._options(req, res, next); - - // no route - if (!route) return next(err); - debug('matched %s %s', route.method, route.path); - - // we have a route - // start at param 0 - req.params = route.params; - keys = route.keys; - i = 0; - - // param callbacks - function param(err) { - paramIndex = 0; - key = keys[i++]; - paramVal = key && req.params[key.name]; - paramCallbacks = key && params[key.name]; - - try { - if ('route' == err) { - nextRoute(); - } else if (err) { - i = 0; - callbacks(err); - } else if (paramCallbacks && undefined !== paramVal) { - paramCallback(); - } else if (key) { - param(); - } else { - i = 0; - callbacks(); - } - } catch (err) { - param(err); - } - }; - - param(err); - - // single param callbacks - function paramCallback(err) { - var fn = paramCallbacks[paramIndex++]; - if (err || !fn) return param(err); - fn(req, res, paramCallback, paramVal, key.name); - } - - // invoke route callbacks - function callbacks(err) { - var fn = route.callbacks[i++]; - try { - if ('route' == err) { - nextRoute(); - } else if (err && fn) { - if (fn.length < 4) return callbacks(err); - fn(err, req, res, callbacks); - } else if (fn) { - if (fn.length < 4) return fn(req, res, callbacks); - callbacks(); - } else { - nextRoute(err); - } - } catch (err) { - callbacks(err); - } - } - })(0); -}; - -/** - * Respond to __OPTIONS__ method. - * - * @param {IncomingMessage} req - * @param {ServerResponse} res - * @api private - */ - -Router.prototype._options = function(req, res, next){ - var path = parse(req).pathname - , body = this._optionsFor(path).join(','); - if (!body) return next(); - res.set('Allow', body).send(body); -}; - -/** - * Return an array of HTTP verbs or "options" for `path`. - * - * @param {String} path - * @return {Array} - * @api private - */ - -Router.prototype._optionsFor = function(path){ - var self = this; - return methods.filter(function(method){ - var routes = self.map[method]; - if (!routes || 'options' == method) return; - for (var i = 0, len = routes.length; i < len; ++i) { - if (routes[i].match(path)) return true; - } - }).map(function(method){ - return method.toUpperCase(); - }); -}; - -/** - * Attempt to match a route for `req` - * with optional starting index of `i` - * defaulting to 0. - * - * @param {IncomingMessage} req - * @param {Number} i - * @return {Route} - * @api private - */ - -Router.prototype.matchRequest = function(req, i, head){ - var method = req.method.toLowerCase() - , url = parse(req) - , path = url.pathname - , routes = this.map - , i = i || 0 - , route; - - // HEAD support - if (!head && 'head' == method) { - route = this.matchRequest(req, i, true); - if (route) return route; - method = 'get'; - } - - // routes for this method - if (routes = routes[method]) { - - // matching routes - for (var len = routes.length; i < len; ++i) { - route = routes[i]; - if (route.match(path)) { - req._route_index = i; - return route; - } - } - } -}; - -/** - * Attempt to match a route for `method` - * and `url` with optional starting - * index of `i` defaulting to 0. - * - * @param {String} method - * @param {String} url - * @param {Number} i - * @return {Route} - * @api private - */ - -Router.prototype.match = function(method, url, i, head){ - var req = { method: method, url: url }; - return this.matchRequest(req, i, head); -}; - -/** - * Route `method`, `path`, and one or more callbacks. - * - * @param {String} method - * @param {String} path - * @param {Function} callback... - * @return {Router} for chaining - * @api private - */ - -Router.prototype.route = function(method, path, callbacks){ - var method = method.toLowerCase() - , callbacks = utils.flatten([].slice.call(arguments, 2)); - - // ensure path was given - if (!path) throw new Error('Router#' + method + '() requires a path'); - - // ensure all callbacks are functions - callbacks.forEach(function(fn){ - if ('function' == typeof fn) return; - var type = {}.toString.call(fn); - var msg = '.' + method + '() requires callback functions but got a ' + type; - throw new Error(msg); - }); - - // create the route - debug('defined %s %s', method, path); - var route = new Route(method, path, callbacks, { - sensitive: this.caseSensitive, - strict: this.strict - }); - - // add it - (this.map[method] = this.map[method] || []).push(route); - return this; -}; - -Router.prototype.all = function(path) { - var self = this; - var args = [].slice.call(arguments); - methods.forEach(function(method){ - self.route.apply(self, [method].concat(args)); - }); - return this; -}; - -methods.forEach(function(method){ - Router.prototype[method] = function(path){ - var args = [method].concat([].slice.call(arguments)); - this.route.apply(this, args); - return this; - }; -}); diff --git a/realtime/node_modules/express/lib/router/route.js b/realtime/node_modules/express/lib/router/route.js deleted file mode 100644 index d7ec88d2..00000000 --- a/realtime/node_modules/express/lib/router/route.js +++ /dev/null @@ -1,78 +0,0 @@ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); - -/** - * Expose `Route`. - */ - -module.exports = Route; - -/** - * Initialize `Route` with the given HTTP `method`, `path`, - * and an array of `callbacks` and `options`. - * - * Options: - * - * - `sensitive` enable case-sensitive routes - * - `strict` enable strict matching for trailing slashes - * - * @param {String} method - * @param {String} path - * @param {Array} callbacks - * @param {Object} options. - * @api private - */ - -function Route(method, path, callbacks, options) { - options = options || {}; - this.path = path; - this.method = method; - this.callbacks = callbacks; - this.regexp = utils.pathRegexp(path - , this.keys = [] - , options.sensitive - , options.strict); -} - -/** - * Check if this route matches `path`, if so - * populate `.params`. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -Route.prototype.match = function(path){ - var keys = this.keys - , params = this.params = [] - , m = this.regexp.exec(path); - - if (!m) return false; - - for (var i = 1, len = m.length; i < len; ++i) { - var key = keys[i - 1]; - - try { - var val = 'string' == typeof m[i] - ? decodeURIComponent(m[i]) - : m[i]; - } catch(e) { - var err = new Error("Failed to decode param '" + m[i] + "'"); - err.status = 400; - throw err; - } - - if (key) { - params[key.name] = val; - } else { - params.push(val); - } - } - - return true; -}; diff --git a/realtime/node_modules/express/lib/utils.js b/realtime/node_modules/express/lib/utils.js deleted file mode 100644 index b30873a8..00000000 --- a/realtime/node_modules/express/lib/utils.js +++ /dev/null @@ -1,314 +0,0 @@ - -/** - * Module dependencies. - */ - -var mime = require('connect').mime - , crc32 = require('buffer-crc32'); - -/** - * toString ref. - */ - -var toString = {}.toString; - -/** - * Return ETag for `body`. - * - * @param {String|Buffer} body - * @return {String} - * @api private - */ - -exports.etag = function(body){ - return '"' + crc32.signed(body) + '"'; -}; - -/** - * Make `locals()` bound to the given `obj`. - * - * This is used for `app.locals` and `res.locals`. - * - * @param {Object} obj - * @return {Function} - * @api private - */ - -exports.locals = function(){ - function locals(obj){ - for (var key in obj) locals[key] = obj[key]; - return obj; - }; - - return locals; -}; - -/** - * Check if `path` looks absolute. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -exports.isAbsolute = function(path){ - if ('/' == path[0]) return true; - if (':' == path[1] && '\\' == path[2]) return true; - if ('\\\\' == path.substring(0, 2)) return true; // Microsoft Azure absolute path -}; - -/** - * Flatten the given `arr`. - * - * @param {Array} arr - * @return {Array} - * @api private - */ - -exports.flatten = function(arr, ret){ - var ret = ret || [] - , len = arr.length; - for (var i = 0; i < len; ++i) { - if (Array.isArray(arr[i])) { - exports.flatten(arr[i], ret); - } else { - ret.push(arr[i]); - } - } - return ret; -}; - -/** - * Normalize the given `type`, for example "html" becomes "text/html". - * - * @param {String} type - * @return {Object} - * @api private - */ - -exports.normalizeType = function(type){ - return ~type.indexOf('/') - ? acceptParams(type) - : { value: mime.lookup(type), params: {} }; -}; - -/** - * Normalize `types`, for example "html" becomes "text/html". - * - * @param {Array} types - * @return {Array} - * @api private - */ - -exports.normalizeTypes = function(types){ - var ret = []; - - for (var i = 0; i < types.length; ++i) { - ret.push(exports.normalizeType(types[i])); - } - - return ret; -}; - -/** - * Return the acceptable type in `types`, if any. - * - * @param {Array} types - * @param {String} str - * @return {String} - * @api private - */ - -exports.acceptsArray = function(types, str){ - // accept anything when Accept is not present - if (!str) return types[0]; - - // parse - var accepted = exports.parseAccept(str) - , normalized = exports.normalizeTypes(types) - , len = accepted.length; - - for (var i = 0; i < len; ++i) { - for (var j = 0, jlen = types.length; j < jlen; ++j) { - if (exports.accept(normalized[j], accepted[i])) { - return types[j]; - } - } - } -}; - -/** - * Check if `type(s)` are acceptable based on - * the given `str`. - * - * @param {String|Array} type(s) - * @param {String} str - * @return {Boolean|String} - * @api private - */ - -exports.accepts = function(type, str){ - if ('string' == typeof type) type = type.split(/ *, */); - return exports.acceptsArray(type, str); -}; - -/** - * Check if `type` array is acceptable for `other`. - * - * @param {Object} type - * @param {Object} other - * @return {Boolean} - * @api private - */ - -exports.accept = function(type, other){ - var t = type.value.split('/'); - return (t[0] == other.type || '*' == other.type) - && (t[1] == other.subtype || '*' == other.subtype) - && paramsEqual(type.params, other.params); -}; - -/** - * Check if accept params are equal. - * - * @param {Object} a - * @param {Object} b - * @return {Boolean} - * @api private - */ - -function paramsEqual(a, b){ - return !Object.keys(a).some(function(k) { - return a[k] != b[k]; - }); -} - -/** - * Parse accept `str`, returning - * an array objects containing - * `.type` and `.subtype` along - * with the values provided by - * `parseQuality()`. - * - * @param {Type} name - * @return {Type} - * @api private - */ - -exports.parseAccept = function(str){ - return exports - .parseParams(str) - .map(function(obj){ - var parts = obj.value.split('/'); - obj.type = parts[0]; - obj.subtype = parts[1]; - return obj; - }); -}; - -/** - * Parse quality `str`, returning an - * array of objects with `.value`, - * `.quality` and optional `.params` - * - * @param {String} str - * @return {Array} - * @api private - */ - -exports.parseParams = function(str){ - return str - .split(/ *, */) - .map(acceptParams) - .filter(function(obj){ - return obj.quality; - }) - .sort(function(a, b){ - if (a.quality === b.quality) { - return a.originalIndex - b.originalIndex; - } else { - return b.quality - a.quality; - } - }); -}; - -/** - * Parse accept params `str` returning an - * object with `.value`, `.quality` and `.params`. - * also includes `.originalIndex` for stable sorting - * - * @param {String} str - * @return {Object} - * @api private - */ - -function acceptParams(str, index) { - var parts = str.split(/ *; */); - var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index }; - - for (var i = 1; i < parts.length; ++i) { - var pms = parts[i].split(/ *= */); - if ('q' == pms[0]) { - ret.quality = parseFloat(pms[1]); - } else { - ret.params[pms[0]] = pms[1]; - } - } - - return ret; -} - -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html) { - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Normalize the given path string, - * returning a regular expression. - * - * An empty array should be passed, - * which will contain the placeholder - * key names. For example "/user/:id" will - * then contain ["id"]. - * - * @param {String|RegExp|Array} path - * @param {Array} keys - * @param {Boolean} sensitive - * @param {Boolean} strict - * @return {RegExp} - * @api private - */ - -exports.pathRegexp = function(path, keys, sensitive, strict) { - if (toString.call(path) == '[object RegExp]') return path; - if (Array.isArray(path)) path = '(' + path.join('|') + ')'; - path = path - .concat(strict ? '' : '/?') - .replace(/\/\(/g, '(?:/') - .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)?/g, function(_, slash, format, key, capture, optional, star){ - keys.push({ name: key, optional: !! optional }); - slash = slash || ''; - return '' - + (optional ? '' : slash) - + '(?:' - + (optional ? slash : '') - + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')' - + (optional || '') - + (star ? '(/*)?' : ''); - }) - .replace(/([\/.])/g, '\\$1') - .replace(/\*/g, '(.*)'); - return new RegExp('^' + path + '$', sensitive ? '' : 'i'); -} diff --git a/realtime/node_modules/express/lib/view.js b/realtime/node_modules/express/lib/view.js deleted file mode 100644 index b9dc69e0..00000000 --- a/realtime/node_modules/express/lib/view.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Module dependencies. - */ - -var path = require('path') - , fs = require('fs') - , utils = require('./utils') - , dirname = path.dirname - , basename = path.basename - , extname = path.extname - , exists = fs.existsSync || path.existsSync - , join = path.join; - -/** - * Expose `View`. - */ - -module.exports = View; - -/** - * Initialize a new `View` with the given `name`. - * - * Options: - * - * - `defaultEngine` the default template engine name - * - `engines` template engine require() cache - * - `root` root path for view lookup - * - * @param {String} name - * @param {Object} options - * @api private - */ - -function View(name, options) { - options = options || {}; - this.name = name; - this.root = options.root; - var engines = options.engines; - this.defaultEngine = options.defaultEngine; - var ext = this.ext = extname(name); - if (!ext && !this.defaultEngine) throw new Error('No default engine was specified and no extension was provided.'); - if (!ext) name += (ext = this.ext = ('.' != this.defaultEngine[0] ? '.' : '') + this.defaultEngine); - this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express); - this.path = this.lookup(name); -} - -/** - * Lookup view by the given `path` - * - * @param {String} path - * @return {String} - * @api private - */ - -View.prototype.lookup = function(path){ - var ext = this.ext; - - // . - if (!utils.isAbsolute(path)) path = join(this.root, path); - if (exists(path)) return path; - - // /index. - path = join(dirname(path), basename(path, ext), 'index' + ext); - if (exists(path)) return path; -}; - -/** - * Render with the given `options` and callback `fn(err, str)`. - * - * @param {Object} options - * @param {Function} fn - * @api private - */ - -View.prototype.render = function(options, fn){ - this.engine(this.path, options, fn); -}; diff --git a/realtime/node_modules/express/node_modules/buffer-crc32/.npmignore b/realtime/node_modules/express/node_modules/buffer-crc32/.npmignore deleted file mode 100644 index b512c09d..00000000 --- a/realtime/node_modules/express/node_modules/buffer-crc32/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/buffer-crc32/.travis.yml b/realtime/node_modules/express/node_modules/buffer-crc32/.travis.yml deleted file mode 100644 index 7a902e8c..00000000 --- a/realtime/node_modules/express/node_modules/buffer-crc32/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 -notifications: - email: - recipients: - - brianloveswords@gmail.com \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/buffer-crc32/README.md b/realtime/node_modules/express/node_modules/buffer-crc32/README.md deleted file mode 100644 index 0d9d8b83..00000000 --- a/realtime/node_modules/express/node_modules/buffer-crc32/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# buffer-crc32 - -[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) - -crc32 that works with binary data and fancy character sets, outputs -buffer, signed or unsigned data and has tests. - -Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix - -# install -``` -npm install buffer-crc32 -``` - -# example -```js -var crc32 = require('buffer-crc32'); -// works with buffers -var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) -crc32(buf) // -> - -// has convenience methods for getting signed or unsigned ints -crc32.signed(buf) // -> -1805997238 -crc32.unsigned(buf) // -> 2488970058 - -// will cast to buffer if given a string, so you can -// directly use foreign characters safely -crc32('自動販売機') // -> - -// and works in append mode too -var partialCrc = crc32('hey'); -var partialCrc = crc32(' ', partialCrc); -var partialCrc = crc32('sup', partialCrc); -var partialCrc = crc32(' ', partialCrc); -var finalCrc = crc32('bros', partialCrc); // -> -``` - -# tests -This was tested against the output of zlib's crc32 method. You can run -the tests with`npm test` (requires tap) - -# see also -https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also -supports buffer inputs and return unsigned ints (thanks @tjholowaychuk). - -# license -MIT/X11 diff --git a/realtime/node_modules/express/node_modules/buffer-crc32/index.js b/realtime/node_modules/express/node_modules/buffer-crc32/index.js deleted file mode 100644 index e29ce3eb..00000000 --- a/realtime/node_modules/express/node_modules/buffer-crc32/index.js +++ /dev/null @@ -1,88 +0,0 @@ -var Buffer = require('buffer').Buffer; - -var CRC_TABLE = [ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d -]; - -function bufferizeInt(num) { - var tmp = Buffer(4); - tmp.writeInt32BE(num, 0); - return tmp; -} - -function _crc32(buf, previous) { - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - if (Buffer.isBuffer(previous)) { - previous = previous.readUInt32BE(0); - } - var crc = ~~previous ^ -1; - for (var n = 0; n < buf.length; n++) { - crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); - } - return (crc ^ -1); -} - -function crc32() { - return bufferizeInt(_crc32.apply(null, arguments)); -} -crc32.signed = function () { - return _crc32.apply(null, arguments); -}; -crc32.unsigned = function () { - return _crc32.apply(null, arguments) >>> 0; -}; - -module.exports = crc32; diff --git a/realtime/node_modules/express/node_modules/buffer-crc32/package.json b/realtime/node_modules/express/node_modules/buffer-crc32/package.json deleted file mode 100644 index cd07ea63..00000000 --- a/realtime/node_modules/express/node_modules/buffer-crc32/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "author": { - "name": "Brian J. Brennan", - "email": "brianloveswords@gmail.com", - "url": "http://bjb.io" - }, - "name": "buffer-crc32", - "description": "A pure javascript CRC32 algorithm that plays nice with binary data", - "version": "0.2.1", - "contributors": [ - { - "name": "Vladimir Kuznetsov" - } - ], - "homepage": "https://github.com/brianloveswords/buffer-crc32", - "repository": { - "type": "git", - "url": "git://github.com/brianloveswords/buffer-crc32.git" - }, - "main": "index.js", - "scripts": { - "test": "./node_modules/.bin/tap tests/*.test.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.2.5" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> \n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('自動販売機') // -> \n\n// and works in append mode too\nvar partialCrc = crc32('hey');\nvar partialCrc = crc32(' ', partialCrc);\nvar partialCrc = crc32('sup', partialCrc);\nvar partialCrc = crc32(' ', partialCrc);\nvar finalCrc = crc32('bros', partialCrc); // -> \n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n\n# see also\nhttps://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also\nsupports buffer inputs and return unsigned ints (thanks @tjholowaychuk).\n\n# license\nMIT/X11\n", - "readmeFilename": "README.md", - "_id": "buffer-crc32@0.2.1", - "dist": { - "shasum": "1481647097358eba59b54a3a1e57ea5531016e58" - }, - "_from": "buffer-crc32@0.2.1", - "_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz" -} diff --git a/realtime/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js b/realtime/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js deleted file mode 100644 index bb0f9efc..00000000 --- a/realtime/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js +++ /dev/null @@ -1,89 +0,0 @@ -var crc32 = require('..'); -var test = require('tap').test; - -test('simple crc32 is no problem', function (t) { - var input = Buffer('hey sup bros'); - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - t.same(crc32(input), expected); - t.end(); -}); - -test('another simple one', function (t) { - var input = Buffer('IEND'); - var expected = Buffer([0xae, 0x42, 0x60, 0x82]); - t.same(crc32(input), expected); - t.end(); -}); - -test('slightly more complex', function (t) { - var input = Buffer([0x00, 0x00, 0x00]); - var expected = Buffer([0xff, 0x41, 0xd9, 0x12]); - t.same(crc32(input), expected); - t.end(); -}); - -test('complex crc32 gets calculated like a champ', function (t) { - var input = Buffer('शीर्षक'); - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('casts to buffer if necessary', function (t) { - var input = 'शीर्षक'; - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('can do signed', function (t) { - var input = 'ham sandwich'; - var expected = -1891873021; - t.same(crc32.signed(input), expected); - t.end(); -}); - -test('can do unsigned', function (t) { - var input = 'bear sandwich'; - var expected = 3711466352; - t.same(crc32.unsigned(input), expected); - t.end(); -}); - - -test('simple crc32 in append mode', function (t) { - var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')]; - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - for (var crc = 0, i = 0; i < input.length; i++) { - crc = crc32(input[i], crc); - } - t.same(crc, expected); - t.end(); -}); - - -test('can do signed in append mode', function (t) { - var input1 = 'ham'; - var input2 = ' '; - var input3 = 'sandwich'; - var expected = -1891873021; - - var crc = crc32.signed(input1); - crc = crc32.signed(input2, crc); - crc = crc32.signed(input3, crc); - - t.same(crc, expected); - t.end(); -}); - -test('can do unsigned in append mode', function (t) { - var input1 = 'bear san'; - var input2 = 'dwich'; - var expected = 3711466352; - - var crc = crc32.unsigned(input1); - crc = crc32.unsigned(input2, crc); - t.same(crc, expected); - t.end(); -}); - diff --git a/realtime/node_modules/express/node_modules/commander/History.md b/realtime/node_modules/express/node_modules/commander/History.md deleted file mode 100644 index ce046f6f..00000000 --- a/realtime/node_modules/express/node_modules/commander/History.md +++ /dev/null @@ -1,174 +0,0 @@ - -1.3.2 / 2013-07-18 -================== - - * add support for sub-commands to co-exist with the original command - -1.3.1 / 2013-07-18 -================== - - * add quick .runningCommand hack so you can opt-out of other logic when running a sub command - -1.3.0 / 2013-07-09 -================== - - * add EACCES error handling - * fix sub-command --help - -1.2.0 / 2013-06-13 -================== - - * allow "-" hyphen as an option argument - * support for RegExp coercion - -1.1.1 / 2012-11-20 -================== - - * add more sub-command padding - * fix .usage() when args are present. Closes #106 - -1.1.0 / 2012-11-16 -================== - - * add git-style executable subcommand support. Closes #94 - -1.0.5 / 2012-10-09 -================== - - * fix `--name` clobbering. Closes #92 - * fix examples/help. Closes #89 - -1.0.4 / 2012-09-03 -================== - - * add `outputHelp()` method. - -1.0.3 / 2012-08-30 -================== - - * remove invalid .version() defaulting - -1.0.2 / 2012-08-24 -================== - - * add `--foo=bar` support [arv] - * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus] - -1.0.1 / 2012-08-03 -================== - - * fix issue #56 - * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode()) - -1.0.0 / 2012-07-05 -================== - - * add support for optional option descriptions - * add defaulting of `.version()` to package.json's version - -0.6.1 / 2012-06-01 -================== - - * Added: append (yes or no) on confirmation - * Added: allow node.js v0.7.x - -0.6.0 / 2012-04-10 -================== - - * Added `.prompt(obj, callback)` support. Closes #49 - * Added default support to .choose(). Closes #41 - * Fixed the choice example - -0.5.1 / 2011-12-20 -================== - - * Fixed `password()` for recent nodes. Closes #36 - -0.5.0 / 2011-12-04 -================== - - * Added sub-command option support [itay] - -0.4.3 / 2011-12-04 -================== - - * Fixed custom help ordering. Closes #32 - -0.4.2 / 2011-11-24 -================== - - * Added travis support - * Fixed: line-buffered input automatically trimmed. Closes #31 - -0.4.1 / 2011-11-18 -================== - - * Removed listening for "close" on --help - -0.4.0 / 2011-11-15 -================== - - * Added support for `--`. Closes #24 - -0.3.3 / 2011-11-14 -================== - - * Fixed: wait for close event when writing help info [Jerry Hamlet] - -0.3.2 / 2011-11-01 -================== - - * Fixed long flag definitions with values [felixge] - -0.3.1 / 2011-10-31 -================== - - * Changed `--version` short flag to `-V` from `-v` - * Changed `.version()` so it's configurable [felixge] - -0.3.0 / 2011-10-31 -================== - - * Added support for long flags only. Closes #18 - -0.2.1 / 2011-10-24 -================== - - * "node": ">= 0.4.x < 0.7.0". Closes #20 - -0.2.0 / 2011-09-26 -================== - - * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] - -0.1.0 / 2011-08-24 -================== - - * Added support for custom `--help` output - -0.0.5 / 2011-08-18 -================== - - * Changed: when the user enters nothing prompt for password again - * Fixed issue with passwords beginning with numbers [NuckChorris] - -0.0.4 / 2011-08-15 -================== - - * Fixed `Commander#args` - -0.0.3 / 2011-08-15 -================== - - * Added default option value support - -0.0.2 / 2011-08-15 -================== - - * Added mask support to `Command#password(str[, mask], fn)` - * Added `Command#password(str, fn)` - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/express/node_modules/commander/Readme.md b/realtime/node_modules/express/node_modules/commander/Readme.md deleted file mode 100644 index ed0aeb2c..00000000 --- a/realtime/node_modules/express/node_modules/commander/Readme.md +++ /dev/null @@ -1,276 +0,0 @@ -# Commander.js - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). - - [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineapple'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineapple - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -function list(val) { - return val.split(',').map(Number); -} - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .prompt(msg, fn) - - Single-line prompt: - -```js -program.prompt('name: ', function(name){ - console.log('hi %s', name); -}); -``` - - Multi-line prompt: - -```js -program.prompt('description:', function(name){ - console.log('hi %s', name); -}); -``` - - Coercion: - -```js -program.prompt('Age: ', Number, function(age){ - console.log('age: %j', age); -}); -``` - -```js -program.prompt('Birthdate: ', Date, function(date){ - console.log('date: %s', date); -}); -``` - -```js -program.prompt('Email: ', /^.+@.+\..+$/, function(email){ - console.log('email: %j', email); -}); -``` - -## .password(msg[, mask], fn) - -Prompt for password without echoing: - -```js -program.password('Password: ', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -Prompt for password with mask char "*": - -```js -program.password('Password: ', '*', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -## .confirm(msg, fn) - - Confirm with the given `msg`: - -```js -program.confirm('continue? ', function(ok){ - console.log(' got %j', ok); -}); -``` - -## .choose(list, fn) - - Let the user choose from a `list`: - -```js -var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - -console.log('Choose the coolest pet:'); -program.choose(list, function(i){ - console.log('you chose %d "%s"', i, list[i]); -}); -``` - -## .outputHelp() - - Output help information without exiting. - -## .help() - - Output help information and exit immediately. - -## Links - - - [API documentation](http://visionmedia.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/visionmedia/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/commander/index.js b/realtime/node_modules/express/node_modules/commander/index.js deleted file mode 100644 index d9634e34..00000000 --- a/realtime/node_modules/express/node_modules/commander/index.js +++ /dev/null @@ -1,1160 +0,0 @@ -/*! - * commander - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , spawn = require('child_process').spawn - , keypress = require('keypress') - , fs = require('fs') - , exists = fs.existsSync - , path = require('path') - , tty = require('tty') - , dirname = path.dirname - , basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command; - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function(){ - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg){ - return arg == this.short - || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = []; - this._args = []; - this._name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function(){ - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd){ - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env){ - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @param {String} [desc] - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name, desc){ - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - if (desc) cmd.description(desc); - if (desc) this.executables = true; - if (desc) this._execs[cmd._name] = true; - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - if (desc) return this; - return cmd; -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args){ - if (!args.length) return; - var self = this; - args.forEach(function(arg){ - switch (arg[0]) { - case '<': - self._args.push({ required: true, name: arg.slice(1, -1) }); - break; - case '[': - self._args.push({ required: false, name: arg.slice(1, -1) }); - break; - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function(){ - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn){ - var self = this; - this.parent.on(this._name, function(args, unknown){ - // Parse any so-far unknown options - unknown = unknown || []; - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i){ - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(this, args); - }); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to false - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => true - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue){ - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if ('function' != typeof fn) defaultValue = fn, fn = null; - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val){ - // coercion - if (null != val && fn) val = fn(val); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv){ - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1]); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - // executable sub-commands - var name = result.args[0]; - if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown); - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown) { - args = args.concat(unknown); - - if (!args.length) this.help(); - if ('help' == args[0] && 1 == args.length) this.help(); - - // --help - if ('help' == args[0]) { - args[0] = args[1]; - args[1] = '--help'; - } - - // executable - var dir = dirname(argv[1]); - var bin = basename(argv[1]) + '-' + args[0]; - - // check for ./ first - var local = path.join(dir, bin); - - // run it - args = args.slice(1); - var proc = spawn(local, args, { stdio: 'inherit', customFds: [0, 1, 2] }); - proc.on('error', function(err){ - if (err.code == "ENOENT") { - console.error('\n %s(1) does not exist, try --help\n', bin); - } else if (err.code == "EACCES") { - console.error('\n %s(1) not executable. try chmod or run with root\n', bin); - } - }); - - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args){ - var ret = [] - , arg - , index; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c){ - ret.push('-' + c); - }); - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown){ - var cmds = this.commands - , len = cmds.length - , name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg){ - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv){ - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || ('-' == arg[0] && '-' != arg)) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name){ - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag){ - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag){ - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags){ - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function(){ - console.log(str); - process.exit(0); - }); - return this; -}; - -/** - * Set the description `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str){ - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str){ - var args = this._args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }); - - var usage = '[options' - + (this.commands.length ? '] [command' : '') - + ']' - + (this._args.length ? ' ' + args : ''); - - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function(){ - return this.options.reduce(function(max, option){ - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function(){ - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option){ - return pad(option.flags, width) - + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function(){ - if (!this.commands.length) return ''; - return [ - '' - , ' Commands:' - , '' - , this.commands.map(function(cmd){ - var args = cmd._args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }).join(' '); - - return pad(cmd._name - + (cmd.options.length - ? ' [options]' - : '') + ' ' + args, 22) - + (cmd.description() - ? ' ' + cmd.description() - : ''); - }).join('\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function(){ - return [ - '' - , ' Usage: ' + this._name + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Prompt for a `Number`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForNumber = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseNumber(val){ - val = Number(val); - if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); - fn(val); - }); -}; - -/** - * Prompt for a `Date`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForDate = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseDate(val){ - val = new Date(val); - if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); - fn(val); - }); -}; - - -/** - * Prompt for a `Regular Expression`. - * - * @param {String} str - * @param {Object} pattern regular expression object to test - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForRegexp = function(str, pattern, fn){ - var self = this; - this.promptSingleLine(str, function parseRegexp(val){ - if(!pattern.test(val)) return self.promptSingleLine(str + '(regular expression mismatch) ', parseRegexp); - fn(val); - }); -}; - - -/** - * Single-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptSingleLine = function(str, fn){ - // determine if the 2nd argument is a regular expression - if (arguments[1].global !== undefined && arguments[1].multiline !== undefined) { - return this.promptForRegexp(str, arguments[1], arguments[2]); - } else if ('function' == typeof arguments[2]) { - return this['promptFor' + (fn.name || fn)](str, arguments[2]); - } - - process.stdout.write(str); - process.stdin.setEncoding('utf8'); - process.stdin.once('data', function(val){ - fn(val.trim()); - }).resume(); -}; - -/** - * Multi-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptMultiLine = function(str, fn){ - var buf = []; - console.log(str); - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(val){ - if ('\n' == val || '\r\n' == val) { - process.stdin.removeAllListeners('data'); - fn(buf.join('\n')); - } else { - buf.push(val.trimRight()); - } - }).resume(); -}; - -/** - * Prompt `str` and callback `fn(val)` - * - * Commander supports single-line and multi-line prompts. - * To issue a single-line prompt simply add white-space - * to the end of `str`, something like "name: ", whereas - * for a multi-line prompt omit this "description:". - * - * - * Examples: - * - * program.prompt('Username: ', function(name){ - * console.log('hi %s', name); - * }); - * - * program.prompt('Description:', function(desc){ - * console.log('description was "%s"', desc.trim()); - * }); - * - * @param {String|Object} str - * @param {Function} fn - * @api public - */ - -Command.prototype.prompt = function(str, fn){ - var self = this; - if ('string' == typeof str) { - if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); - this.promptMultiLine(str, fn); - } else { - var keys = Object.keys(str) - , obj = {}; - - function next() { - var key = keys.shift() - , label = str[key]; - - if (!key) return fn(obj); - self.prompt(label, function(val){ - obj[key] = val; - next(); - }); - } - - next(); - } -}; - -/** - * Prompt for password with `str`, `mask` char and callback `fn(val)`. - * - * The mask string defaults to '', aka no output is - * written while typing, you may want to use "*" etc. - * - * Examples: - * - * program.password('Password: ', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * program.password('Password: ', '*', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {String} mask - * @param {Function} fn - * @api public - */ - -Command.prototype.password = function(str, mask, fn){ - var self = this - , buf = ''; - - // default mask - if ('function' == typeof mask) { - fn = mask; - mask = ''; - } - - keypress(process.stdin); - - function setRawMode(mode) { - if (process.stdin.setRawMode) { - process.stdin.setRawMode(mode); - } else { - tty.setRawMode(mode); - } - }; - setRawMode(true); - process.stdout.write(str); - - // keypress - process.stdin.on('keypress', function(c, key){ - if (key && 'enter' == key.name) { - console.log(); - process.stdin.pause(); - process.stdin.removeAllListeners('keypress'); - setRawMode(false); - if (!buf.trim().length) return self.password(str, mask, fn); - fn(buf); - return; - } - - if (key && key.ctrl && 'c' == key.name) { - console.log('%s', buf); - process.exit(); - } - - process.stdout.write(mask); - buf += c; - }).resume(); -}; - -/** - * Confirmation prompt with `str` and callback `fn(bool)` - * - * Examples: - * - * program.confirm('continue? ', function(ok){ - * console.log(' got %j', ok); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {Function} fn - * @api public - */ - - -Command.prototype.confirm = function(str, fn, verbose){ - var self = this; - this.prompt(str, function(ok){ - if (!ok.trim()) { - if (!verbose) str += '(yes or no) '; - return self.confirm(str, fn, true); - } - fn(parseBool(ok)); - }); -}; - -/** - * Choice prompt with `list` of items and callback `fn(index, item)` - * - * Examples: - * - * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - * - * console.log('Choose the coolest pet:'); - * program.choose(list, function(i){ - * console.log('you chose %d "%s"', i, list[i]); - * process.stdin.destroy(); - * }); - * - * @param {Array} list - * @param {Number|Function} index or fn - * @param {Function} fn - * @api public - */ - -Command.prototype.choose = function(list, index, fn){ - var self = this - , hasDefault = 'number' == typeof index; - - if (!hasDefault) { - fn = index; - index = null; - } - - list.forEach(function(item, i){ - if (hasDefault && i == index) { - console.log('* %d) %s', i + 1, item); - } else { - console.log(' %d) %s', i + 1, item); - } - }); - - function again() { - self.prompt(' : ', function(val){ - val = parseInt(val, 10) - 1; - if (hasDefault && isNaN(val)) val = index; - - if (null == list[val]) { - again(); - } else { - fn(val, list[val]); - } - }); - } - - again(); -}; - - -/** - * Output help information for this command - * - * @api public - */ - -Command.prototype.outputHelp = function(){ - process.stdout.write(this.helpInformation()); - this.emit('--help'); -}; - -/** - * Output help information and exit. - * - * @api public - */ - -Command.prototype.help = function(){ - this.outputHelp(); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word){ - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Parse a boolean `str`. - * - * @param {String} str - * @return {Boolean} - * @api private - */ - -function parseBool(str) { - return /^y|yes|ok|true$/i.test(str); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - cmd.outputHelp(); - process.exit(0); - } - } -} diff --git a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/README.md b/realtime/node_modules/express/node_modules/commander/node_modules/keypress/README.md deleted file mode 100644 index a768e8f5..00000000 --- a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/README.md +++ /dev/null @@ -1,101 +0,0 @@ -keypress -======== -### Make any Node ReadableStream emit "keypress" events - - -Previous to Node `v0.8.x`, there was an undocumented `"keypress"` event that -`process.stdin` would emit when it was a TTY. Some people discovered this hidden -gem, and started using it in their own code. - -Now in Node `v0.8.x`, this `"keypress"` event does not get emitted by default, -but rather only when it is being used in conjuction with the `readline` (or by -extension, the `repl`) module. - -This module is the exact logic from the node `v0.8.x` releases ripped out into its -own module. - -__Bonus:__ Now with mouse support! - -Installation ------------- - -Install with `npm`: - -``` bash -$ npm install keypress -``` - -Or add it to the `"dependencies"` section of your _package.json_ file. - - -Example -------- - -#### Listening for "keypress" events - -``` js -var keypress = require('keypress'); - -// make `process.stdin` begin emitting "keypress" events -keypress(process.stdin); - -// listen for the "keypress" event -process.stdin.on('keypress', function (ch, key) { - console.log('got "keypress"', key); - if (key && key.ctrl && key.name == 'c') { - process.stdin.pause(); - } -}); - -process.stdin.setRawMode(true); -process.stdin.resume(); -``` - -#### Listening for "mousepress" events - -``` js -var keypress = require('keypress'); - -// make `process.stdin` begin emitting "mousepress" (and "keypress") events -keypress(process.stdin); - -// you must enable the mouse events before they will begin firing -keypress.enableMouse(process.stdout); - -process.stdin.on('mousepress', function (info) { - console.log('got "mousepress" event at %d x %d', info.x, info.y); -}); - -process.on('exit', function () { - // disable mouse on exit, so that the state - // is back to normal for the terminal - keypress.disableMouse(process.stdout); -}); -``` - - -License -------- - -(The MIT License) - -Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> - -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/realtime/node_modules/express/node_modules/commander/node_modules/keypress/index.js b/realtime/node_modules/express/node_modules/commander/node_modules/keypress/index.js deleted file mode 100644 index c2ba488b..00000000 --- a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/index.js +++ /dev/null @@ -1,346 +0,0 @@ - -/** - * This module offers the internal "keypress" functionality from node-core's - * `readline` module, for your own programs and modules to use. - * - * Usage: - * - * require('keypress')(process.stdin); - * - * process.stdin.on('keypress', function (ch, key) { - * console.log(ch, key); - * if (key.ctrl && key.name == 'c') { - * process.stdin.pause(); - * } - * }); - * proces.stdin.resume(); - */ -var exports = module.exports = keypress; - -exports.enableMouse = function (stream) { - stream.write('\x1b' +'[?1000h') -} - -exports.disableMouse = function (stream) { - stream.write('\x1b' +'[?1000l') -} - - -/** - * accepts a readable Stream instance and makes it emit "keypress" events - */ - -function keypress(stream) { - if (isEmittingKeypress(stream)) return; - stream._emitKeypress = true; - - function onData(b) { - if (stream.listeners('keypress').length > 0) { - emitKey(stream, b); - } else { - // Nobody's watching anyway - stream.removeListener('data', onData); - stream.on('newListener', onNewListener); - } - } - - function onNewListener(event) { - if (event == 'keypress') { - stream.on('data', onData); - stream.removeListener('newListener', onNewListener); - } - } - - if (stream.listeners('keypress').length > 0) { - stream.on('data', onData); - } else { - stream.on('newListener', onNewListener); - } -} - -/** - * Returns `true` if the stream is already emitting "keypress" events. - * `false` otherwise. - */ - -function isEmittingKeypress(stream) { - var rtn = stream._emitKeypress; - if (!rtn) { - // hack: check for the v0.6.x "data" event - stream.listeners('data').forEach(function (l) { - if (l.name == 'onData' && /emitKey/.test(l.toString())) { - rtn = true; - stream._emitKeypress = true; - } - }); - } - if (!rtn) { - // hack: check for the v0.6.x "newListener" event - stream.listeners('newListener').forEach(function (l) { - if (l.name == 'onNewListener' && /keypress/.test(l.toString())) { - rtn = true; - stream._emitKeypress = true; - } - }); - } - return rtn; -} - - -/* - Some patterns seen in terminal key escape codes, derived from combos seen - at http://www.midnight-commander.org/browser/lib/tty/key.c - - ESC letter - ESC [ letter - ESC [ modifier letter - ESC [ 1 ; modifier letter - ESC [ num char - ESC [ num ; modifier char - ESC O letter - ESC O modifier letter - ESC O 1 ; modifier letter - ESC N letter - ESC [ [ num ; modifier char - ESC [ [ 1 ; modifier letter - ESC ESC [ num char - ESC ESC O letter - - - char is usually ~ but $ and ^ also happen with rxvt - - modifier is 1 + - (shift * 1) + - (left_alt * 2) + - (ctrl * 4) + - (right_alt * 8) - - two leading ESCs apparently mean the same as one leading ESC -*/ - -// Regexes used for ansi escape code splitting -var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/; -var functionKeyCodeRe = - /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/; - -function emitKey(stream, s) { - var ch, - key = { - name: undefined, - ctrl: false, - meta: false, - shift: false - }, - parts; - - if (Buffer.isBuffer(s)) { - if (s[0] > 127 && s[1] === undefined) { - s[0] -= 128; - s = '\x1b' + s.toString(stream.encoding || 'utf-8'); - } else { - s = s.toString(stream.encoding || 'utf-8'); - } - } - - key.sequence = s; - - if (s === '\r' || s === '\n') { - // enter - key.name = 'enter'; - - } else if (s === '\t') { - // tab - key.name = 'tab'; - - } else if (s === '\b' || s === '\x7f' || - s === '\x1b\x7f' || s === '\x1b\b') { - // backspace or ctrl+h - key.name = 'backspace'; - key.meta = (s.charAt(0) === '\x1b'); - - } else if (s === '\x1b' || s === '\x1b\x1b') { - // escape key - key.name = 'escape'; - key.meta = (s.length === 2); - - } else if (s === ' ' || s === '\x1b ') { - key.name = 'space'; - key.meta = (s.length === 2); - - } else if (s <= '\x1a') { - // ctrl+letter - key.name = String.fromCharCode(s.charCodeAt(0) + 'a'.charCodeAt(0) - 1); - key.ctrl = true; - - } else if (s.length === 1 && s >= 'a' && s <= 'z') { - // lowercase letter - key.name = s; - - } else if (s.length === 1 && s >= 'A' && s <= 'Z') { - // shift+letter - key.name = s.toLowerCase(); - key.shift = true; - - } else if (parts = metaKeyCodeRe.exec(s)) { - // meta+character key - key.name = parts[1].toLowerCase(); - key.meta = true; - key.shift = /^[A-Z]$/.test(parts[1]); - - } else if (parts = functionKeyCodeRe.exec(s)) { - // ansi escape sequence - - // reassemble the key code leaving out leading \x1b's, - // the modifier key bitflag and any meaningless "1;" sequence - var code = (parts[1] || '') + (parts[2] || '') + - (parts[4] || '') + (parts[6] || ''), - modifier = (parts[3] || parts[5] || 1) - 1; - - // Parse the key modifier - key.ctrl = !!(modifier & 4); - key.meta = !!(modifier & 10); - key.shift = !!(modifier & 1); - key.code = code; - - // Parse the key itself - switch (code) { - /* xterm/gnome ESC O letter */ - case 'OP': key.name = 'f1'; break; - case 'OQ': key.name = 'f2'; break; - case 'OR': key.name = 'f3'; break; - case 'OS': key.name = 'f4'; break; - - /* xterm/rxvt ESC [ number ~ */ - case '[11~': key.name = 'f1'; break; - case '[12~': key.name = 'f2'; break; - case '[13~': key.name = 'f3'; break; - case '[14~': key.name = 'f4'; break; - - /* from Cygwin and used in libuv */ - case '[[A': key.name = 'f1'; break; - case '[[B': key.name = 'f2'; break; - case '[[C': key.name = 'f3'; break; - case '[[D': key.name = 'f4'; break; - case '[[E': key.name = 'f5'; break; - - /* common */ - case '[15~': key.name = 'f5'; break; - case '[17~': key.name = 'f6'; break; - case '[18~': key.name = 'f7'; break; - case '[19~': key.name = 'f8'; break; - case '[20~': key.name = 'f9'; break; - case '[21~': key.name = 'f10'; break; - case '[23~': key.name = 'f11'; break; - case '[24~': key.name = 'f12'; break; - - /* xterm ESC [ letter */ - case '[A': key.name = 'up'; break; - case '[B': key.name = 'down'; break; - case '[C': key.name = 'right'; break; - case '[D': key.name = 'left'; break; - case '[E': key.name = 'clear'; break; - case '[F': key.name = 'end'; break; - case '[H': key.name = 'home'; break; - - /* xterm/gnome ESC O letter */ - case 'OA': key.name = 'up'; break; - case 'OB': key.name = 'down'; break; - case 'OC': key.name = 'right'; break; - case 'OD': key.name = 'left'; break; - case 'OE': key.name = 'clear'; break; - case 'OF': key.name = 'end'; break; - case 'OH': key.name = 'home'; break; - - /* xterm/rxvt ESC [ number ~ */ - case '[1~': key.name = 'home'; break; - case '[2~': key.name = 'insert'; break; - case '[3~': key.name = 'delete'; break; - case '[4~': key.name = 'end'; break; - case '[5~': key.name = 'pageup'; break; - case '[6~': key.name = 'pagedown'; break; - - /* putty */ - case '[[5~': key.name = 'pageup'; break; - case '[[6~': key.name = 'pagedown'; break; - - /* rxvt */ - case '[7~': key.name = 'home'; break; - case '[8~': key.name = 'end'; break; - - /* rxvt keys with modifiers */ - case '[a': key.name = 'up'; key.shift = true; break; - case '[b': key.name = 'down'; key.shift = true; break; - case '[c': key.name = 'right'; key.shift = true; break; - case '[d': key.name = 'left'; key.shift = true; break; - case '[e': key.name = 'clear'; key.shift = true; break; - - case '[2$': key.name = 'insert'; key.shift = true; break; - case '[3$': key.name = 'delete'; key.shift = true; break; - case '[5$': key.name = 'pageup'; key.shift = true; break; - case '[6$': key.name = 'pagedown'; key.shift = true; break; - case '[7$': key.name = 'home'; key.shift = true; break; - case '[8$': key.name = 'end'; key.shift = true; break; - - case 'Oa': key.name = 'up'; key.ctrl = true; break; - case 'Ob': key.name = 'down'; key.ctrl = true; break; - case 'Oc': key.name = 'right'; key.ctrl = true; break; - case 'Od': key.name = 'left'; key.ctrl = true; break; - case 'Oe': key.name = 'clear'; key.ctrl = true; break; - - case '[2^': key.name = 'insert'; key.ctrl = true; break; - case '[3^': key.name = 'delete'; key.ctrl = true; break; - case '[5^': key.name = 'pageup'; key.ctrl = true; break; - case '[6^': key.name = 'pagedown'; key.ctrl = true; break; - case '[7^': key.name = 'home'; key.ctrl = true; break; - case '[8^': key.name = 'end'; key.ctrl = true; break; - - /* misc. */ - case '[Z': key.name = 'tab'; key.shift = true; break; - default: key.name = 'undefined'; break; - - } - } else if (s.length > 1 && s[0] !== '\x1b') { - // Got a longer-than-one string of characters. - // Probably a paste, since it wasn't a control sequence. - Array.prototype.forEach.call(s, function(c) { - emitKey(stream, c); - }); - return; - } - - if (key.code == '[M') { - key.name = 'mouse'; - var s = key.sequence; - var b = s.charCodeAt(3); - key.x = s.charCodeAt(4) - 040; - key.y = s.charCodeAt(5) - 040; - - key.scroll = 0; - - key.ctrl = !!(1<<4 & b); - key.meta = !!(1<<3 & b); - key.shift = !!(1<<2 & b); - - key.release = (3 & b) === 3; - - if (1<<6 & b) { //scroll - key.scroll = 1 & b ? 1 : -1; - } - - if (!key.release && !key.scroll) { - key.button = b & 3; - } - } - - // Don't emit a key if no name was found - if (key.name === undefined) { - key = undefined; - } - - if (s.length === 1) { - ch = s; - } - - if (key && key.name == 'mouse') { - stream.emit('mousepress', key) - } else if (key || ch) { - stream.emit('keypress', ch, key); - } -} diff --git a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/package.json b/realtime/node_modules/express/node_modules/commander/node_modules/keypress/package.json deleted file mode 100644 index 6cdf0856..00000000 --- a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "keypress", - "version": "0.1.0", - "description": "Make any Node ReadableStream emit \"keypress\" events", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://tootallnate.net" - }, - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/keypress.git" - }, - "keywords": [ - "keypress", - "readline", - "core" - ], - "license": "MIT", - "readme": "keypress\n========\n### Make any Node ReadableStream emit \"keypress\" events\n\n\nPrevious to Node `v0.8.x`, there was an undocumented `\"keypress\"` event that\n`process.stdin` would emit when it was a TTY. Some people discovered this hidden\ngem, and started using it in their own code.\n\nNow in Node `v0.8.x`, this `\"keypress\"` event does not get emitted by default,\nbut rather only when it is being used in conjuction with the `readline` (or by\nextension, the `repl`) module.\n\nThis module is the exact logic from the node `v0.8.x` releases ripped out into its\nown module.\n\n__Bonus:__ Now with mouse support!\n\nInstallation\n------------\n\nInstall with `npm`:\n\n``` bash\n$ npm install keypress\n```\n\nOr add it to the `\"dependencies\"` section of your _package.json_ file.\n\n\nExample\n-------\n\n#### Listening for \"keypress\" events\n\n``` js\nvar keypress = require('keypress');\n\n// make `process.stdin` begin emitting \"keypress\" events\nkeypress(process.stdin);\n\n// listen for the \"keypress\" event\nprocess.stdin.on('keypress', function (ch, key) {\n console.log('got \"keypress\"', key);\n if (key && key.ctrl && key.name == 'c') {\n process.stdin.pause();\n }\n});\n\nprocess.stdin.setRawMode(true);\nprocess.stdin.resume();\n```\n\n#### Listening for \"mousepress\" events\n\n``` js\nvar keypress = require('keypress');\n\n// make `process.stdin` begin emitting \"mousepress\" (and \"keypress\") events\nkeypress(process.stdin);\n\n// you must enable the mouse events before they will begin firing\nkeypress.enableMouse(process.stdout);\n\nprocess.stdin.on('mousepress', function (info) {\n console.log('got \"mousepress\" event at %d x %d', info.x, info.y);\n});\n\nprocess.on('exit', function () {\n // disable mouse on exit, so that the state\n // is back to normal for the terminal\n keypress.disableMouse(process.stdout);\n});\n```\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "README.md", - "_id": "keypress@0.1.0", - "_from": "keypress@0.1.x" -} diff --git a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/test.js b/realtime/node_modules/express/node_modules/commander/node_modules/keypress/test.js deleted file mode 100644 index c3f61d79..00000000 --- a/realtime/node_modules/express/node_modules/commander/node_modules/keypress/test.js +++ /dev/null @@ -1,28 +0,0 @@ - -var keypress = require('./') -keypress(process.stdin) - -if (process.stdin.setRawMode) - process.stdin.setRawMode(true) -else - require('tty').setRawMode(true) - -process.stdin.on('keypress', function (c, key) { - console.log(0, c, key) - if (key && key.ctrl && key.name == 'c') { - process.stdin.pause() - } -}) -process.stdin.on('mousepress', function (mouse) { - console.log(mouse) -}) - -keypress.enableMouse(process.stdout) -process.on('exit', function () { - //disable mouse on exit, so that the state is back to normal - //for the terminal. - keypress.disableMouse(process.stdout) -}) - -process.stdin.resume() - diff --git a/realtime/node_modules/express/node_modules/commander/package.json b/realtime/node_modules/express/node_modules/commander/package.json deleted file mode 100644 index 7085bf2a..00000000 --- a/realtime/node_modules/express/node_modules/commander/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "commander", - "version": "1.3.2", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt", - "stdin" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/commander.js.git" - }, - "dependencies": { - "keypress": "0.1.x" - }, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.6.x" - }, - "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineapple');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineapple\n -b, --bbq Add bbq sauce\n -c, --cheese Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] ')\n .option('-i, --integer ', 'An integer argument', parseInt)\n .option('-f, --float ', 'A float argument', parseFloat)\n .option('-r, --range ..', 'A range', range)\n .option('-l, --list ', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n```js\nprogram.prompt('Email: ', /^.+@.+\\..+$/, function(email){\n console.log('email: %j', email);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## .outputHelp()\n\n Output help information without exiting.\n\n## .help()\n\n Output help information and exit immediately.\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "commander@1.3.2", - "dist": { - "shasum": "2dcc593d1983f411896193000f018b047694e50b" - }, - "_from": "commander@1.3.2", - "_resolved": "https://registry.npmjs.org/commander/-/commander-1.3.2.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/.npmignore b/realtime/node_modules/express/node_modules/connect/.npmignore deleted file mode 100644 index 9046dde5..00000000 --- a/realtime/node_modules/express/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/realtime/node_modules/express/node_modules/connect/.travis.yml b/realtime/node_modules/express/node_modules/connect/.travis.yml deleted file mode 100644 index a12e3f0f..00000000 --- a/realtime/node_modules/express/node_modules/connect/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/LICENSE b/realtime/node_modules/express/node_modules/connect/LICENSE deleted file mode 100644 index 0c5d22d9..00000000 --- a/realtime/node_modules/express/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/realtime/node_modules/express/node_modules/connect/Readme.md b/realtime/node_modules/express/node_modules/connect/Readme.md deleted file mode 100644 index e38a3263..00000000 --- a/realtime/node_modules/express/node_modules/connect/Readme.md +++ /dev/null @@ -1,84 +0,0 @@ -# Connect [![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect) - - Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_. - - Connect is bundled with over _20_ commonly used middleware, including - a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/). - -```js -var connect = require('connect') - , http = require('http'); - -var app = connect() - .use(connect.favicon()) - .use(connect.logger('dev')) - .use(connect.static('public')) - .use(connect.directory('public')) - .use(connect.cookieParser()) - .use(connect.session({ secret: 'my secret here' })) - .use(function(req, res){ - res.end('Hello from Connect!\n'); - }); - -http.createServer(app).listen(3000); -``` - -## Middleware - - - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html) - - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html) - - [compress](http://www.senchalabs.org/connect/compress.html) - - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html) - - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html) - - [csrf](http://www.senchalabs.org/connect/csrf.html) - - [directory](http://www.senchalabs.org/connect/directory.html) - - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html) - - [favicon](http://www.senchalabs.org/connect/favicon.html) - - [json](http://www.senchalabs.org/connect/json.html) - - [limit](http://www.senchalabs.org/connect/limit.html) - - [logger](http://www.senchalabs.org/connect/logger.html) - - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html) - - [multipart](http://www.senchalabs.org/connect/multipart.html) - - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html) - - [query](http://www.senchalabs.org/connect/query.html) - - [responseTime](http://www.senchalabs.org/connect/responseTime.html) - - [session](http://www.senchalabs.org/connect/session.html) - - [static](http://www.senchalabs.org/connect/static.html) - - [staticCache](http://www.senchalabs.org/connect/staticCache.html) - - [subdomains](http://www.senchalabs.org/connect/subdomains.html) - - [vhost](http://www.senchalabs.org/connect/vhost.html) - -## Running Tests - -first: - - $ npm install -d - -then: - - $ make test - -## Contributors - - https://github.com/senchalabs/connect/graphs/contributors - -## Node Compatibility - - Connect `< 1.x` is compatible with node 0.2.x - - - Connect `1.x` is compatible with node 0.4.x - - - Connect `2.x` is compatible with node 0.6.x - - - Connect (_master_) is compatible with node 0.8.x - -## CLA - - [http://sencha.com/cla](http://sencha.com/cla) - -## License - -View the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/). diff --git a/realtime/node_modules/express/node_modules/connect/index.js b/realtime/node_modules/express/node_modules/connect/index.js deleted file mode 100644 index 23240eed..00000000 --- a/realtime/node_modules/express/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/realtime/node_modules/express/node_modules/connect/lib/cache.js b/realtime/node_modules/express/node_modules/connect/lib/cache.js deleted file mode 100644 index 052fcdb3..00000000 --- a/realtime/node_modules/express/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/realtime/node_modules/express/node_modules/connect/lib/connect.js b/realtime/node_modules/express/node_modules/connect/lib/connect.js deleted file mode 100644 index 72961dca..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/connect.js +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * Connect - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , proto = require('./proto') - , utils = require('./utils') - , path = require('path') - , basename = path.basename - , fs = require('fs'); - -// node patches - -require('./patch'); - -// expose createServer() as the module - -exports = module.exports = createServer; - -/** - * Framework version. - */ - -exports.version = '2.7.11'; - -/** - * Expose mime module. - */ - -exports.mime = require('./middleware/static').mime; - -/** - * Expose the prototype. - */ - -exports.proto = proto; - -/** - * Auto-load middleware getters. - */ - -exports.middleware = {}; - -/** - * Expose utilities. - */ - -exports.utils = utils; - -/** - * Create a new connect server. - * - * @return {Function} - * @api public - */ - -function createServer() { - function app(req, res, next){ app.handle(req, res, next); } - utils.merge(app, proto); - utils.merge(app, EventEmitter.prototype); - app.route = '/'; - app.stack = []; - for (var i = 0; i < arguments.length; ++i) { - app.use(arguments[i]); - } - return app; -}; - -/** - * Support old `.createServer()` method. - */ - -createServer.createServer = createServer; - -/** - * Auto-load bundled middleware with getters. - */ - -fs.readdirSync(__dirname + '/middleware').forEach(function(filename){ - if (!/\.js$/.test(filename)) return; - var name = basename(filename, '.js'); - function load(){ return require('./middleware/' + name); } - exports.middleware.__defineGetter__(name, load); - exports.__defineGetter__(name, load); -}); diff --git a/realtime/node_modules/express/node_modules/connect/lib/index.js b/realtime/node_modules/express/node_modules/connect/lib/index.js deleted file mode 100644 index 5938c753..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/index.js +++ /dev/null @@ -1,50 +0,0 @@ - -/** - * Connect is a middleware framework for node, - * shipping with over 18 bundled middleware and a rich selection of - * 3rd-party middleware. - * - * var app = connect() - * .use(connect.logger('dev')) - * .use(connect.static('public')) - * .use(function(req, res){ - * res.end('hello world\n'); - * }) - * - * http.createServer(app).listen(3000); - * - * Installation: - * - * $ npm install connect - * - * Middleware: - * - * - [logger](logger.html) request logger with custom format support - * - [csrf](csrf.html) Cross-site request forgery protection - * - [compress](compress.html) Gzip compression middleware - * - [basicAuth](basicAuth.html) basic http authentication - * - [bodyParser](bodyParser.html) extensible request body parser - * - [json](json.html) application/json parser - * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser - * - [multipart](multipart.html) multipart/form-data parser - * - [timeout](timeout.html) request timeouts - * - [cookieParser](cookieParser.html) cookie parser - * - [session](session.html) session management support with bundled MemoryStore - * - [cookieSession](cookieSession.html) cookie-based session support - * - [methodOverride](methodOverride.html) faux HTTP method support - * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time - * - [staticCache](staticCache.html) memory cache layer for the static() middleware - * - [static](static.html) streaming static file server supporting `Range` and more - * - [directory](directory.html) directory listing middleware - * - [vhost](vhost.html) virtual host sub-domain mapping middleware - * - [favicon](favicon.html) efficient favicon server (with default icon) - * - [limit](limit.html) limit the bytesize of request bodies - * - [query](query.html) automatic querystring parser, populating `req.query` - * - [errorHandler](errorHandler.html) flexible error handler - * - * Links: - * - * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware - * - GitHub [repository](http://github.com/senchalabs/connect) - * - */ \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js deleted file mode 100644 index 8af07ca0..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js +++ /dev/null @@ -1,106 +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: - * - * Status: Deprecated. No bug reports or pull requests are welcomed - * for this middleware. However, this middleware will not be removed. - * Instead, you should use [basic-auth](https://github.com/visionmedia/node-basic-auth). - * - * Enfore basic authentication by providing a `callback(user, pass)`, - * which must return `true` in order to gain access. Alternatively an async - * method is provided as well, invoking `callback(user, pass, callback)`. Populates - * `req.user`. The final alternative is simply passing username / password - * strings. - * - * Simple username and password - * - * connect(connect.basicAuth('username', 'password')); - * - * Callback verification - * - * connect() - * .use(connect.basicAuth(function(user, pass){ - * return 'tj' == user && 'wahoo' == pass; - * })) - * - * Async callback verification, accepting `fn(err, user)`. - * - * connect() - * .use(connect.basicAuth(function(user, pass, fn){ - * User.authenticate({ user: user, pass: pass }, fn); - * })) - * - * @param {Function|String} callback or username - * @param {String} realm - * @api public - */ - -module.exports = function basicAuth(callback, realm) { - var username, password; - - // user / pass strings - if ('string' == typeof callback) { - username = callback; - password = realm; - if ('string' != typeof password) throw new Error('password argument required'); - realm = arguments[2]; - callback = function(user, pass){ - return user == username && pass == password; - } - } - - realm = realm || 'Authorization Required'; - - return function(req, res, next) { - var authorization = req.headers.authorization; - - if (req.user) return next(); - if (!authorization) return unauthorized(res, realm); - - var parts = authorization.split(' '); - - if (parts.length !== 2) return next(utils.error(400)); - - var scheme = parts[0] - , credentials = new Buffer(parts[1], 'base64').toString() - , index = credentials.indexOf(':'); - - if ('Basic' != scheme || index < 0) return next(utils.error(400)); - - var user = credentials.slice(0, index) - , pass = credentials.slice(index + 1); - - // async - if (callback.length >= 3) { - var pause = utils.pause(req); - callback(user, pass, function(err, user){ - if (err || !user) return unauthorized(res, realm); - req.user = req.remoteUser = user; - next(); - pause.resume(); - }); - // sync - } else { - if (callback(user, pass)) { - req.user = req.remoteUser = user; - next(); - } else { - unauthorized(res, realm); - } - } - } -}; - diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js deleted file mode 100644 index 14481f56..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js +++ /dev/null @@ -1,68 +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: - * - * Status: the multipart body parser will be removed in Connect 3. - * - * 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. - * - * If you wish to create your own body parser, you may be interested in: - * - * - [raw-body](https://github.com/stream-utils/raw-body) - * - [body](https://github.com/raynos/body) - * - * @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/realtime/node_modules/express/node_modules/connect/lib/middleware/compress.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/compress.js deleted file mode 100644 index a300e530..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/compress.js +++ /dev/null @@ -1,192 +0,0 @@ -/*! - * Connect - compress - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var zlib = require('zlib'); -var utils = require('../utils'); -var Negotiator = require('negotiator'); - -/** - * Supported content-encoding methods. - */ - -exports.methods = { - gzip: zlib.createGzip - , deflate: zlib.createDeflate -}; - -/** - * Default filter function. - */ - -exports.filter = function(req, res){ - return /json|text|javascript|dart|image\/svg\+xml|application\/x-font-ttf|application\/vnd\.ms-opentype|application\/vnd\.ms-fontobject/.test(res.getHeader('Content-Type')); -}; - -/** - * Compress: - * - * Compress response data with gzip/deflate. - * - * Filter: - * - * A `filter` callback function may be passed to - * replace the default logic of: - * - * exports.filter = function(req, res){ - * return /json|text|javascript/.test(res.getHeader('Content-Type')); - * }; - * - * Threshold: - * - * Only compress the response if the byte size is at or above a threshold. - * Always compress while streaming. - * - * - `threshold` - string representation of size or bytes as an integer. - * - * Options: - * - * All remaining options are passed to the gzip/deflate - * creation functions. Consult node's docs for additional details. - * - * - `chunkSize` (default: 16*1024) - * - `windowBits` - * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression - * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more - * - `strategy`: compression strategy - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function compress(options) { - options = options || {}; - var filter = options.filter || exports.filter; - var threshold; - - if (false === options.threshold || 0 === options.threshold) { - threshold = 0 - } else if ('string' === typeof options.threshold) { - threshold = utils.parseBytes(options.threshold) - } else { - threshold = options.threshold || 1024 - } - - return function compress(req, res, next){ - var accept = req.headers['accept-encoding'] - , write = res.write - , end = res.end - , compress = true - , stream; - - // see #724 - req.on('close', function(){ - res.write = res.end = function(){}; - }); - - // flush is noop by default - res.flush = noop; - - // proxy - - res.write = function(chunk, encoding){ - if (!this.headerSent) { - // if content-length is set and is lower - // than the threshold, don't compress - var length = res.getHeader('content-length'); - if (!isNaN(length) && length < threshold) compress = false; - this._implicitHeader(); - } - return stream - ? stream.write(new Buffer(chunk, encoding)) - : write.call(res, chunk, encoding); - }; - - res.end = function(chunk, encoding){ - if (chunk) { - if (!this.headerSent && getSize(chunk) < threshold) compress = false; - this.write(chunk, encoding); - } else if (!this.headerSent) { - // response size === 0 - compress = false; - } - return stream - ? stream.end() - : end.call(res); - }; - - res.on('header', function(){ - // default request filter - if (!filter(req, res)) return; - - // vary - var vary = res.getHeader('Vary'); - if (!vary) { - res.setHeader('Vary', 'Accept-Encoding'); - } else if (!~vary.indexOf('Accept-Encoding')) { - res.setHeader('Vary', vary + ', Accept-Encoding'); - } - - if (!compress) return; - - var encoding = res.getHeader('Content-Encoding') || 'identity'; - - // already encoded - if ('identity' != encoding) return; - - // SHOULD use identity - if (!accept) return; - - // head - if ('HEAD' == req.method) return; - - // compression method - var method = new Negotiator(req).preferredEncoding(['gzip', 'deflate', 'identity']); - // negotiation failed - if (method === 'identity') return; - - // compression stream - stream = exports.methods[method](options); - - // overwrite the flush method - res.flush = function(){ - stream.flush(); - } - - // header fields - res.setHeader('Content-Encoding', method); - res.removeHeader('Content-Length'); - - // compression - stream.on('data', function(chunk){ - write.call(res, chunk); - }); - - stream.on('end', function(){ - end.call(res); - }); - - stream.on('drain', function() { - res.emit('drain'); - }); - }); - - next(); - }; -}; - -function getSize(chunk) { - return Buffer.isBuffer(chunk) - ? chunk.length - : Buffer.byteLength(chunk); -} - -function noop(){} diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js deleted file mode 100644 index 665226c4..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js +++ /dev/null @@ -1,67 +0,0 @@ - -/*! - * Connect - cookieParser - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('./../utils') - , cookie = require('cookie'); - -/** - * Cookie parser: - * - * Status: Deprecated. This middleware will be removed in - * Connect 3.0 and will be replaced by a `cookies` middleware, - * which will use [cookies](http://github.com/jed/cookies) - * and [keygrip](https://github.com/jed/keygrip). - * - * Parse _Cookie_ header and populate `req.cookies` - * with an object keyed by the cookie names. Optionally - * you may enabled signed cookie support by passing - * a `secret` string, which assigns `req.secret` so - * it may be used by other middleware. - * - * Examples: - * - * connect() - * .use(connect.cookieParser('optional secret string')) - * .use(function(req, res, next){ - * res.end(JSON.stringify(req.cookies)); - * }) - * - * @param {String} secret - * @return {Function} - * @api public - */ - -module.exports = function cookieParser(secret, opt){ - return function cookieParser(req, res, next) { - if (req.cookies) return next(); - var cookies = req.headers.cookie; - - req.secret = secret; - req.cookies = {}; - req.signedCookies = {}; - - if (cookies) { - try { - req.cookies = cookie.parse(cookies, opt); - if (secret) { - req.signedCookies = utils.parseSignedCookies(req.cookies, secret); - req.signedCookies = utils.parseJSONCookies(req.signedCookies); - } - req.cookies = utils.parseJSONCookies(req.cookies); - } catch (err) { - err.status = 400; - return next(err); - } - } - next(); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js deleted file mode 100644 index 663f2b97..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js +++ /dev/null @@ -1,122 +0,0 @@ -/*! - * Connect - cookieSession - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('./../utils') - , Cookie = require('./session/cookie') - , debug = require('debug')('connect:cookieSession') - , signature = require('cookie-signature') - , crc32 = require('buffer-crc32') - , url = require('url'); - -/** - * Cookie Session: - * - * Cookie session middleware. - * - * var app = connect(); - * app.use(connect.cookieParser()); - * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }})); - * - * Options: - * - * - `key` cookie name defaulting to `connect.sess` - * - `secret` prevents cookie tampering - * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` - * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") - * - * Clearing sessions: - * - * To clear the session simply set its value to `null`, - * `cookieSession()` will then respond with a 1970 Set-Cookie. - * - * req.session = null; - * - * If you are interested in more sophisticated solutions, - * you may be interested in: - * - * - [client-sessions](https://github.com/mozilla/node-client-sessions) - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function cookieSession(options){ - // TODO: utilize Session/Cookie to unify API - options = options || {}; - var key = options.key || 'connect.sess' - , trustProxy = options.proxy; - - return function cookieSession(req, res, next) { - - // req.secret is for backwards compatibility - var secret = options.secret || req.secret; - if (!secret) throw new Error('`secret` option required for cookie sessions'); - - // default session - req.session = {}; - var cookie = req.session.cookie = new Cookie(options.cookie); - - // pathname mismatch - var originalPath = url.parse(req.originalUrl).pathname; - if (0 != originalPath.indexOf(cookie.path)) return next(); - - // cookieParser secret - if (!options.secret && req.secret) { - req.session = req.signedCookies[key] || {}; - req.session.cookie = cookie; - } else { - // TODO: refactor - var rawCookie = req.cookies[key]; - if (rawCookie) { - var unsigned = utils.parseSignedCookie(rawCookie, secret); - if (unsigned) { - var originalHash = crc32.signed(unsigned); - req.session = utils.parseJSONCookie(unsigned) || {}; - req.session.cookie = cookie; - } - } - } - - res.on('header', function(){ - // removed - if (!req.session) { - debug('clear session'); - cookie.expires = new Date(0); - res.setHeader('Set-Cookie', cookie.serialize(key, '')); - return; - } - - delete req.session.cookie; - - // check security - var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() - , tls = req.connection.encrypted || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0]); - - // only send secure cookies via https - if (cookie.secure && !tls) return debug('not secured'); - - // serialize - debug('serializing %j', req.session); - var val = 'j:' + JSON.stringify(req.session); - - // compare hashes, no need to set-cookie if unchanged - if (originalHash == crc32.signed(val)) return debug('unmodified session'); - - // set-cookie - val = 's:' + signature.sign(val, secret); - val = cookie.serialize(key, val); - debug('set-cookie %j', cookie); - res.setHeader('Set-Cookie', val); - }); - - next(); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/csrf.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/csrf.js deleted file mode 100644 index 1c3854b4..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/csrf.js +++ /dev/null @@ -1,163 +0,0 @@ -/*! - * Connect - csrf - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); -var uid = require('uid2'); -var crypto = require('crypto'); - -/** - * Anti CSRF: - * - * CSRF protection middleware. - * - * This middleware adds a `req.csrfToken()` function to make a token - * 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 session. - * - * The default `value` function checks `req.body` generated - * by the `bodyParser()` middleware, `req.query` generated - * by `query()`, and the "X-CSRF-Token" header field. - * - * This middleware requires session support, thus should be added - * somewhere _below_ `session()` and `cookieParser()`. - * - * Options: - * - * - `value` a function accepting the request, returning the token - * - * @param {Object} options - * @api public - */ - -module.exports = function csrf(options) { - options = options || {}; - var value = options.value || defaultValue; - - return function(req, res, next){ - - // already have one - var secret = req.session._csrfSecret; - if (secret) return createToken(secret); - - // generate secret - uid(24, function(err, secret){ - if (err) return next(err); - req.session._csrfSecret = secret; - createToken(secret); - }); - - // generate the token - function createToken(secret) { - var token; - - // lazy-load token - req.csrfToken = function csrfToken() { - return token || (token = saltedToken(secret)); - }; - - // compatibility with old middleware - Object.defineProperty(req.session, '_csrf', { - configurable: true, - get: function() { - console.warn('req.session._csrf is deprecated, use req.csrfToken() instead'); - return req.csrfToken(); - } - }); - - // ignore these methods - if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next(); - - // determine user-submitted value - var val = value(req); - - // check - if (!checkToken(val, secret)) return next(utils.error(403)); - - next(); - } - } -}; - -/** - * Default value function, checking the `req.body` - * and `req.query` for the CSRF token. - * - * @param {IncomingMessage} req - * @return {String} - * @api private - */ - -function defaultValue(req) { - return (req.body && req.body._csrf) - || (req.query && req.query._csrf) - || (req.headers['x-csrf-token']) - || (req.headers['x-xsrf-token']); -} - -/** - * Return salted token. - * - * @param {String} secret - * @return {String} - * @api private - */ - -function saltedToken(secret) { - return createToken(generateSalt(10), secret); -} - -/** - * Creates a CSRF token from a given salt and secret. - * - * @param {String} salt (should be 10 characters) - * @param {String} secret - * @return {String} - * @api private - */ - -function createToken(salt, secret) { - return salt + crypto - .createHash('sha1') - .update(salt + secret) - .digest('base64'); -} - -/** - * Checks if a given CSRF token matches the given secret. - * - * @param {String} token - * @param {String} secret - * @return {Boolean} - * @api private - */ - -function checkToken(token, secret) { - if ('string' != typeof token) return false; - return token === createToken(token.slice(0, 10), secret); -} - -/** - * Generates a random salt, using a fast non-blocking PRNG (Math.random()). - * - * @param {Number} length - * @return {String} - * @api private - */ - -function generateSalt(length) { - var i, r = []; - for (i = 0; i < length; ++i) { - r.push(SALTCHARS[Math.floor(Math.random() * SALTCHARS.length)]); - } - return r.join(''); -} - -var SALTCHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/directory.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/directory.js deleted file mode 100644 index ac8ea7a5..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/directory.js +++ /dev/null @@ -1,330 +0,0 @@ - -/*! - * Connect - directory - * Copyright(c) 2011 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -// 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 - , sep = path.sep - , extname = path.extname - , join = path.join; -var Batch = require('batch'); -var Negotiator = require('negotiator'); - -/*! - * Icon cache. - */ - -var cache = {}; - -/** - * Media types and the map for content negotiation. - */ - -var mediaTypes = [ - 'text/html', - 'text/plain', - 'application/json' -]; - -var mediaType = { - 'text/html': 'html', - 'text/plain': 'plain', - 'application/json': 'json' -}; - -/** - * 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 - , view = options.view || 'tiles' - , filter = options.filter - , root = normalize(root + sep); - - return function directory(req, res, next) { - if ('GET' != req.method && 'HEAD' != req.method) return next(); - - var url = parse(req.url) - , dir = decodeURIComponent(url.pathname) - , path = normalize(join(root, dir)) - , originalUrl = parse(req.originalUrl) - , originalDir = decodeURIComponent(originalUrl.pathname) - , showUp = 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 - var type = new Negotiator(req).preferredMediaType(mediaTypes); - - // not acceptable - if (!type) return next(utils.error(406)); - exports[mediaType[type]](req, res, files, next, originalDir, showUp, icons, path, view); - }); - }); - }; -}; - -/** - * Respond with text/html. - */ - -exports.html = function(req, res, files, next, dir, showUp, icons, path, view){ - 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); - stat(path, files, function(err, stats){ - if (err) return next(err); - files = files.map(function(file, i){ return { name: file, stat: stats[i] }; }); - files.sort(fileSort); - if (showUp) files.unshift({ name: '..' }); - str = str - .replace('{style}', style.concat(iconStyle(files, icons))) - .replace('{files}', html(files, dir, icons, view)) - .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); -}; - -/** - * Sort function for with directories first. - */ - -function fileSort(a, b) { - return Number(b.stat && b.stat.isDirectory()) - Number(a.stat && a.stat.isDirectory()) || - String(a.name).toLocaleLowerCase().localeCompare(String(b.name).toLocaleLowerCase()); -} - -/** - * Map html `dir`, returning a linked path. - */ - -function htmlPath(dir) { - var curr = []; - return dir.split('/').map(function(part){ - curr.push(encodeURIComponent(part)); - return part ? '' + part + '' : ''; - }).join(' / '); -} - -/** - * Load icon images, return css string. - */ - -function iconStyle (files, useIcons) { - if (!useIcons) return ''; - var data = {}; - var views = { tiles: [], details: [], mobile: [] }; - - for (var i=0; i < files.length; i++) { - var file = files[i]; - if (file.name == '..') continue; - - var isDir = '..' == file.name || (file.stat && file.stat.isDirectory()); - var icon = isDir ? icons.folder : icons[extname(file.name)] || icons.default; - - var ext = extname(file.name); - ext = isDir ? '.directory' : (icons[ext] ? ext : '.default'); - - if (data[icon]) continue; - data[icon] = ext + ' .name{background-image: url(data:image/png;base64,' + load(icon)+');}'; - views.tiles.push('.view-tiles ' + data[icon]); - views.details.push('.view-details ' + data[icon]); - views.mobile.push('#files ' + data[icon]); - } - - var style = views.tiles.join('\n') - + '\n'+views.details.join('\n') - + '\n@media (max-width: 768px) {\n\t' - + views.mobile.join('\n\t') - + '\n}'; - return style; -} - -/** - * Map html `files`, returning an html unordered list. - */ - -function html(files, dir, useIcons, view) { - return '
    ' - + (view == 'details' ? ( - '
  • ' - + 'Name' - + 'Size' - + 'Modified' - + '
  • ') : '') - + files.map(function(file){ - var isDir - , classes = [] - , path = dir.split('/').map(function (c) { return encodeURIComponent(c); }); - - if (useIcons) { - var ext = extname(file.name); - isDir = '..' == file.name || (file.stat && file.stat.isDirectory()); - ext = isDir ? '.directory' : (icons[ext] ? ext : '.default'); - classes.push('icon'); - classes.push(ext.replace('.','')); - } - - path.push(encodeURIComponent(file.name)); - - var date = file.name == '..' ? '' - : file.stat.mtime.toDateString()+' '+file.stat.mtime.toLocaleTimeString(); - var size = file.name == '..' ? '' : file.stat.size; - - return '
  • ' - + ''+file.name+'' - + ''+size+'' - + ''+date+'' - + '
  • '; - - }).join('\n') + '
'; -} - -/** - * 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]; - }); -} - -/** - * Stat all files and return array of stat - * in same order. - */ - -function stat(dir, files, cb) { - var batch = new Batch(); - - batch.concurrency(10); - - files.forEach(function(file, i){ - batch.push(function(done){ - fs.stat(join(dir, file), done); - }); - }); - - batch.end(cb); -} - -/** - * 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' - , 'folder': 'folder.png' - , 'default': 'page_white.png' -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js deleted file mode 100644 index 56e96830..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js +++ /dev/null @@ -1,86 +0,0 @@ -/*! - * Connect - errorHandler - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , fs = require('fs'); - -// environment - -var env = process.env.NODE_ENV || 'development'; - -/** - * Error handler: - * - * Development error handler, providing stack traces - * and error message responses for requests accepting text, html, - * or json. - * - * Text: - * - * By default, and when _text/plain_ is accepted a simple stack trace - * or error message will be returned. - * - * JSON: - * - * When _application/json_ is accepted, connect will respond with - * an object in the form of `{ "error": error }`. - * - * HTML: - * - * When accepted connect will output a nice html stack trace. - * - * @return {Function} - * @api public - */ - -exports = module.exports = function errorHandler(){ - return function errorHandler(err, req, res, next){ - if (err.status) res.statusCode = err.status; - if (res.statusCode < 400) res.statusCode = 500; - if ('test' != env) console.error(err.stack); - var accept = req.headers.accept || ''; - // html - if (~accept.indexOf('html')) { - fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){ - fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){ - var stack = (err.stack || '') - .split('\n').slice(1) - .map(function(v){ return '
  • ' + v + '
  • '; }).join(''); - html = html - .replace('{style}', style) - .replace('{stack}', stack) - .replace('{title}', exports.title) - .replace('{statusCode}', res.statusCode) - .replace(/\{error\}/g, utils.escape(err.toString().replace(/\n/g, '
    '))); - 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.setHeader('Content-Type', 'text/plain'); - res.end(err.stack); - } - }; -}; - -/** - * Template title, framework authors may override this value. - */ - -exports.title = 'Connect'; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/favicon.js deleted file mode 100644 index ef543544..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/favicon.js +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * Connect - favicon - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , utils = require('../utils'); - -/** - * Favicon: - * - * By default serves the connect favicon, or the favicon - * located by the given `path`. - * - * Options: - * - * - `maxAge` cache-control max-age directive, defaulting to 1 day - * - * Examples: - * - * Serve default favicon: - * - * connect() - * .use(connect.favicon()) - * - * Serve favicon before logging for brevity: - * - * connect() - * .use(connect.favicon()) - * .use(connect.logger('dev')) - * - * Serve custom favicon: - * - * connect() - * .use(connect.favicon('public/favicon.ico')) - * - * @param {String} path - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function favicon(path, options){ - var options = options || {} - , path = path || __dirname + '/../public/favicon.ico' - , maxAge = options.maxAge || 86400000 - , icon; // favicon cache - - return function favicon(req, res, next){ - if ('/favicon.ico' == req.url) { - if (icon) { - res.writeHead(200, icon.headers); - res.end(icon.body); - } else { - fs.readFile(path, function(err, buf){ - if (err) return next(err); - icon = { - headers: { - 'Content-Type': 'image/x-icon' - , 'Content-Length': buf.length - , 'ETag': '"' + utils.md5(buf) + '"' - , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) - }, - body: buf - }; - res.writeHead(200, icon.headers); - res.end(icon.body); - }); - } - } else { - next(); - } - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/json.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/json.js deleted file mode 100644 index ef489852..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/json.js +++ /dev/null @@ -1,87 +0,0 @@ - -/*! - * Connect - json - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); -var getBody = require('raw-body'); - -/** - * JSON: - * - * Parse JSON request bodies, providing the - * parsed object as `req.body`. - * - * Options: - * - * - `strict` when `false` anything `JSON.parse()` accepts will be parsed - * - `reviver` used as the second "reviver" argument for JSON.parse - * - `limit` byte limit [1mb] - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - var strict = options.strict !== false; - var verify = typeof options.verify === 'function' && options.verify; - - return function json(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - - if (!utils.hasBody(req)) return next(); - - // check Content-Type - if (!exports.regexp.test(utils.mime(req))) return next(); - - // flag as parsed - req._body = true; - - // parse - getBody(req, { - limit: options.limit || '1mb', - length: req.headers['content-length'], - encoding: 'utf8' - }, function (err, buf) { - if (err) return next(err); - - if (verify) { - try { - verify(req, res, buf) - } catch (err) { - if (!err.status) err.status = 403; - return next(err); - } - } - - var first = buf.trim()[0]; - - if (0 == buf.length) { - return next(utils.error(400, 'invalid json, empty body')); - } - - if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json')); - try { - req.body = JSON.parse(buf, options.reviver); - } catch (err){ - err.body = buf; - err.status = 400; - return next(err); - } - next(); - }) - }; -}; - -exports.regexp = /^application\/([\w!#\$%&\*`\-\.\^~]*\+)?json$/i; - diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/limit.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/limit.js deleted file mode 100644 index 2b895f97..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/limit.js +++ /dev/null @@ -1,89 +0,0 @@ - -/*! - * Connect - limit - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'), - brokenPause = utils.brokenPause; - -/** - * Limit: - * - * Status: Deprecated. This middleware will be removed in Connect 3.0. - * If you still wish to use some type of limit middleware, - * you may be interested in: - * - * - [raw-body](https://github.com/stream-utils/raw-body) - * - * Limit request bodies to the given size in `bytes`. - * - * A string representation of the bytesize may also be passed, - * for example "5mb", "200kb", "1gb", etc. - * - * connect() - * .use(connect.limit('5.5mb')) - * .use(handleImageUpload) - * - * @param {Number|String} bytes - * @return {Function} - * @api public - */ - -module.exports = function limit(bytes){ - if ('string' == typeof bytes) bytes = utils.parseBytes(bytes); - if ('number' != typeof bytes) throw new Error('limit() bytes required'); - - if (process.env.NODE_ENV !== 'test') { - console.warn('connect.limit() will be removed in connect 3.0'); - } - - return function limit(req, res, next){ - var received = 0 - , len = req.headers['content-length'] - ? parseInt(req.headers['content-length'], 10) - : null; - - // self-awareness - if (req._limit) return next(); - req._limit = true; - - // limit by content-length - if (len && len > bytes) return next(utils.error(413)); - - // limit - if (brokenPause) { - listen(); - } else { - req.on('newListener', function handler(event) { - if (event !== 'data') return; - - req.removeListener('newListener', handler); - // Start listening at the end of the current loop - // otherwise the request will be consumed too early. - // Sideaffect is `limit` will miss the first chunk, - // but that's not a big deal. - // Unfortunately, the tests don't have large enough - // request bodies to test this. - process.nextTick(listen); - }); - }; - - next(); - - function listen() { - req.on('data', function(chunk) { - received += Buffer.isBuffer(chunk) - ? chunk.length : - Buffer.byteLength(chunk); - - if (received > bytes) req.destroy(); - }); - }; - }; -}; \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/logger.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/logger.js deleted file mode 100644 index fba43e41..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/logger.js +++ /dev/null @@ -1,342 +0,0 @@ -/*! - * Connect - logger - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var bytes = require('bytes'); - -/*! - * Log buffer. - */ - -var buf = []; - -/*! - * Default log buffer duration. - */ - -var defaultBufferDuration = 1000; - -/** - * Logger: - * - * Log requests with the given `options` or a `format` string. - * - * Options: - * - * - `format` Format string, see below for tokens - * - `stream` Output stream, defaults to _stdout_ - * - `buffer` Buffer duration, defaults to 1000ms when _true_ - * - `immediate` Write log line on request instead of response (for response times) - * - * Tokens: - * - * - `:req[header]` ex: `:req[Accept]` - * - `:res[header]` ex: `:res[Content-Length]` - * - `:http-version` - * - `:response-time` - * - `:remote-addr` - * - `:date` - * - `:method` - * - `:url` - * - `:referrer` - * - `:user-agent` - * - `:status` - * - * Formats: - * - * Pre-defined formats that ship with connect: - * - * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"' - * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms' - * - `tiny` ':method :url :status :res[content-length] - :response-time ms' - * - `dev` concise output colored by response status for development use - * - * Examples: - * - * connect.logger() // default - * connect.logger('short') - * connect.logger('tiny') - * connect.logger({ immediate: true, format: 'dev' }) - * connect.logger(':method :url - :referrer') - * connect.logger(':req[content-type] -> :res[content-type]') - * connect.logger(function(tokens, req, res){ return 'some format string' }) - * - * Defining Tokens: - * - * To define a token, simply invoke `connect.logger.token()` with the - * name and a callback function. The value returned is then available - * as ":type" in this case. - * - * connect.logger.token('type', function(req, res){ return req.headers['content-type']; }) - * - * Defining Formats: - * - * All default formats are defined this way, however it's public API as well: - * - * connect.logger.format('name', 'string or function') - * - * @param {String|Function|Object} format or options - * @return {Function} - * @api public - */ - -exports = module.exports = function logger(options) { - if ('object' == typeof options) { - options = options || {}; - } else if (options) { - options = { format: options }; - } else { - options = {}; - } - - // output on request instead of response - var immediate = options.immediate; - - // format name - var fmt = exports[options.format] || options.format || exports.default; - - // compile format - if ('function' != typeof fmt) fmt = compile(fmt); - - // options - var stream = options.stream || process.stdout - , buffer = options.buffer; - - // buffering support - if (buffer) { - var realStream = stream - , interval = 'number' == typeof buffer - ? buffer - : defaultBufferDuration; - - // flush interval - setInterval(function(){ - if (buf.length) { - realStream.write(buf.join('')); - buf.length = 0; - } - }, interval); - - // swap the stream - stream = { - write: function(str){ - buf.push(str); - } - }; - } - - return function logger(req, res, next) { - var sock = req.socket; - req._startTime = new Date; - req._remoteAddress = sock.socket ? sock.socket.remoteAddress : sock.remoteAddress; - - function logRequest(){ - res.removeListener('finish', logRequest); - res.removeListener('close', logRequest); - var line = fmt(exports, req, res); - if (null == line) return; - stream.write(line + '\n'); - }; - - // immediate - if (immediate) { - logRequest(); - // proxy end to output logging - } else { - res.on('finish', logRequest); - res.on('close', logRequest); - } - - - next(); - }; -}; - -/** - * Compile `fmt` into a function. - * - * @param {String} fmt - * @return {Function} - * @api private - */ - -function compile(fmt) { - fmt = fmt.replace(/"/g, '\\"'); - var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){ - return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "'; - }) + '";' - return new Function('tokens, req, res', js); -}; - -/** - * Define a token function with the given `name`, - * and callback `fn(req, res)`. - * - * @param {String} name - * @param {Function} fn - * @return {Object} exports for chaining - * @api public - */ - -exports.token = function(name, fn) { - exports[name] = fn; - return this; -}; - -/** - * Define a `fmt` with the given `name`. - * - * @param {String} name - * @param {String|Function} fmt - * @return {Object} exports for chaining - * @api public - */ - -exports.format = function(name, str){ - exports[name] = str; - return this; -}; - -/** - * Default format. - */ - -exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'); - -/** - * Short format. - */ - -exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'); - -/** - * Tiny format. - */ - -exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms'); - -/** - * dev (colored) - */ - -exports.format('dev', function(tokens, req, res){ - var status = res.statusCode - , len = parseInt(res.getHeader('Content-Length'), 10) - , color = 32; - - if (status >= 500) color = 31 - else if (status >= 400) color = 33 - else if (status >= 300) color = 36; - - len = isNaN(len) - ? '' - : len = ' - ' + bytes(len); - - return '\x1b[90m' + req.method - + ' ' + req.originalUrl + ' ' - + '\x1b[' + color + 'm' + res.statusCode - + ' \x1b[90m' - + (new Date - req._startTime) - + 'ms' + len - + '\x1b[0m'; -}); - -/** - * request url - */ - -exports.token('url', function(req){ - return req.originalUrl || req.url; -}); - -/** - * request method - */ - -exports.token('method', function(req){ - return req.method; -}); - -/** - * response time in milliseconds - */ - -exports.token('response-time', function(req){ - return String(Date.now() - req._startTime); -}); - -/** - * UTC date - */ - -exports.token('date', function(){ - return new Date().toUTCString(); -}); - -/** - * response status code - */ - -exports.token('status', function(req, res){ - return res.headerSent ? res.statusCode : null; -}); - -/** - * normalized referrer - */ - -exports.token('referrer', function(req){ - return req.headers['referer'] || req.headers['referrer']; -}); - -/** - * remote address - */ - -exports.token('remote-addr', function(req){ - if (req.ip) return req.ip; - if (req._remoteAddress) return req._remoteAddress; - var sock = req.socket; - if (sock.socket) return sock.socket.remoteAddress; - return sock.remoteAddress; -}); - -/** - * HTTP version - */ - -exports.token('http-version', function(req){ - return req.httpVersionMajor + '.' + req.httpVersionMinor; -}); - -/** - * UA string - */ - -exports.token('user-agent', function(req){ - return req.headers['user-agent']; -}); - -/** - * request header - */ - -exports.token('req', function(req, res, field){ - return req.headers[field.toLowerCase()]; -}); - -/** - * response header - */ - -exports.token('res', function(req, res, field){ - return (res._headers || {})[field.toLowerCase()]; -}); - diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js deleted file mode 100644 index a729d136..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js +++ /dev/null @@ -1,58 +0,0 @@ -/*! - * Connect - methodOverride - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var methods = require('methods'); - -/** - * Method Override: - * - * Provides faux HTTP method support. - * - * Pass an optional `key` to use when checking for - * a method override, otherwise defaults to _\_method_. - * The original method is available via `req.originalMethod`. - * - * @param {String} key - * @return {Function} - * @api public - */ - -module.exports = function methodOverride(key){ - key = key || "_method"; - return function methodOverride(req, res, next) { - var method; - req.originalMethod = req.originalMethod || req.method; - - // req.body - if (req.body && typeof req.body === 'object' && key in req.body) { - method = req.body[key].toLowerCase(); - delete req.body[key]; - } - - // check X-HTTP-Method-Override - if (req.headers['x-http-method-override']) { - method = req.headers['x-http-method-override'].toLowerCase(); - } - - // replace - if (supports(method)) req.method = method.toUpperCase(); - - next(); - }; -}; - -/** - * Check if node supports `method`. - */ - -function supports(method) { - return ~methods.indexOf(method); -} diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/multipart.js deleted file mode 100644 index 8bf66389..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/multipart.js +++ /dev/null @@ -1,171 +0,0 @@ -/*! - * Connect - multipart - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var multiparty = require('multiparty') - , _limit = require('./limit') - , utils = require('../utils') - , qs = require('qs'); - -/** - * Multipart: - * - * Status: Deprecated. The multipart parser will be removed in Connect 3.0. - * Please use one of the following parsers/middleware directly: - * - * - [formidable](https://github.com/felixge/node-formidable) - * - [connect-multiparty](https://github.com/superjoe30/connect-multiparty) or [multiparty] - * - [connect-busboy](https://github.com/mscdex/connect-busboy) or [busboy](https://github.com/mscdex/busboy) - * - * Parse multipart/form-data request bodies, - * providing the parsed object as `req.body` - * and `req.files`. - * - * Configuration: - * - * The options passed are merged with [multiparty](https://github.com/superjoe30/node-multiparty)'s - * `Form` object, allowing you to configure the upload directory, - * size limits, etc. For example if you wish to change the upload dir do the following. - * - * app.use(connect.multipart({ uploadDir: path })); - * - * Options: - * - * - `limit` byte limit defaulting to [100mb] - * - `defer` defers processing and exposes the multiparty form object as `req.form`. - * `next()` is called without waiting for the form's "end" event. - * This option is useful if you need to bind to the "progress" or "part" events, for example. - * - * Temporary Files: - * - * By default temporary files are used, stored in `os.tmpDir()`. These - * are not automatically garbage collected, you are in charge of moving them - * or deleting them. When `defer` is not used and these files are created you - * may refernce them via the `req.files` object. - * - * req.files.images.forEach(function(file){ - * console.log(' uploaded : %s %skb : %s', file.originalFilename, file.size / 1024 | 0, file.path); - * }); - * - * It is highly recommended to monitor and clean up tempfiles in any production - * environment, you may use tools like [reap](https://github.com/visionmedia/reap) - * to do so. - * - * Streaming: - * - * When `defer` is used files are _not_ streamed to tmpfiles, you may - * access them via the "part" events and stream them accordingly: - * - * req.form.on('part', function(part){ - * // transfer to s3 etc - * console.log('upload %s %s', part.name, part.filename); - * var out = fs.createWriteStream('/tmp/' + part.filename); - * part.pipe(out); - * }); - * - * req.form.on('close', function(){ - * res.end('uploaded!'); - * }); - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - - if (process.env.NODE_ENV !== 'test') { - console.warn('connect.multipart() will be removed in connect 3.0'); - console.warn('visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives'); - } - - var limit = _limit(options.limit || '100mb'); - - return function multipart(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - req.files = req.files || {}; - - if (!utils.hasBody(req)) return next(); - - // ignore GET - if ('GET' == req.method || 'HEAD' == req.method) return next(); - - // check Content-Type - if ('multipart/form-data' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - limit(req, res, function(err){ - if (err) return next(err); - - var form = new multiparty.Form(options) - , 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); - }); - - if (!options.defer) { - form.on('file', function(name, val){ - val.name = val.originalFilename; - val.type = val.headers['content-type'] || null; - ondata(name, val, files); - }); - } - - form.on('error', function(err){ - if (!options.defer) { - err.status = 400; - next(err); - } - done = true; - }); - - form.on('close', function(){ - if (done) return; - try { - req.body = qs.parse(data); - req.files = qs.parse(files); - } catch (err) { - form.emit('error', err); - return; - } - if (!options.defer) next(); - }); - - form.parse(req); - - if (options.defer) { - req.form = form; - next(); - } - }); - } -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/query.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/query.js deleted file mode 100644 index f0fb50fc..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/query.js +++ /dev/null @@ -1,47 +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 using - * [qs](https://github.com/visionmedia/node-querystring). - * - * 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/realtime/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/responseTime.js deleted file mode 100644 index 62abc049..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/responseTime.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Connect - responseTime - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Reponse time: - * - * Adds the `X-Response-Time` header displaying the response - * duration in milliseconds. - * - * @return {Function} - * @api public - */ - -module.exports = function responseTime(){ - return function(req, res, next){ - var start = new Date; - - if (res._responseTime) return next(); - res._responseTime = true; - - res.on('header', function(){ - var duration = new Date - start; - res.setHeader('X-Response-Time', duration + 'ms'); - }); - - next(); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/session.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/session.js deleted file mode 100644 index 128bc591..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/session.js +++ /dev/null @@ -1,358 +0,0 @@ -/*! - * Connect - session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Session = require('./session/session') - , debug = require('debug')('connect:session') - , MemoryStore = require('./session/memory') - , signature = require('cookie-signature') - , Cookie = require('./session/cookie') - , Store = require('./session/store') - , utils = require('./../utils') - , uid = require('uid2') - , crc32 = require('buffer-crc32') - , parse = require('url').parse; - -// environment - -var env = process.env.NODE_ENV; - -/** - * Expose the middleware. - */ - -exports = module.exports = session; - -/** - * Expose constructors. - */ - -exports.Store = Store; -exports.Cookie = Cookie; -exports.Session = Session; -exports.MemoryStore = MemoryStore; - -/** - * Warning message for `MemoryStore` usage in production. - */ - -var warning = 'Warning: connection.session() MemoryStore is not\n' - + 'designed for a production environment, as it will leak\n' - + 'memory, and will not scale past a single process.'; - -/** - * Session: - * - * Setup session store with the given `options`. - * - * Session data is _not_ saved in the cookie itself, however - * cookies are used, so we must use the [cookieParser()](cookieParser.html) - * middleware _before_ `session()`. - * - * Examples: - * - * connect() - * .use(connect.cookieParser()) - * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }})) - * - * Options: - * - * - `key` cookie name defaulting to `connect.sid` - * - `store` session store instance - * - `secret` session cookie is signed with this secret to prevent tampering - * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` - * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") - * - * Cookie option: - * - * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set - * so the cookie becomes a browser-session cookie. When the user closes the - * browser the cookie (and session) will be removed. - * - * ## req.session - * - * To store or access session data, simply use the request property `req.session`, - * which is (generally) serialized as JSON by the store, so nested objects - * are typically fine. For example below is a user-specific view counter: - * - * connect() - * .use(connect.favicon()) - * .use(connect.cookieParser()) - * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) - * .use(function(req, res, next){ - * var sess = req.session; - * if (sess.views) { - * res.setHeader('Content-Type', 'text/html'); - * res.write('

    views: ' + sess.views + '

    '); - * res.write('

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

    '); - * res.end(); - * sess.views++; - * } else { - * sess.views = 1; - * res.end('welcome to the session demo. refresh!'); - * } - * } - * )).listen(3000); - * - * ## Session#regenerate() - * - * To regenerate the session simply invoke the method, once complete - * a new SID and `Session` instance will be initialized at `req.session`. - * - * req.session.regenerate(function(err){ - * // will have a new session here - * }); - * - * ## Session#destroy() - * - * Destroys the session, removing `req.session`, will be re-generated next request. - * - * req.session.destroy(function(err){ - * // cannot access session here - * }); - * - * ## Session#reload() - * - * Reloads the session data. - * - * req.session.reload(function(err){ - * // session updated - * }); - * - * ## Session#save() - * - * Save the session. - * - * req.session.save(function(err){ - * // session saved - * }); - * - * ## Session#touch() - * - * Updates the `.maxAge` property. Typically this is - * not necessary to call, as the session middleware does this for you. - * - * ## Session#cookie - * - * Each session has a unique cookie object accompany it. This allows - * you to alter the session cookie per visitor. For example we can - * set `req.session.cookie.expires` to `false` to enable the cookie - * to remain for only the duration of the user-agent. - * - * ## Session#maxAge - * - * Alternatively `req.session.cookie.maxAge` will return the time - * remaining in milliseconds, which we may also re-assign a new value - * to adjust the `.expires` property appropriately. The following - * are essentially equivalent - * - * var hour = 3600000; - * req.session.cookie.expires = new Date(Date.now() + hour); - * req.session.cookie.maxAge = hour; - * - * For example when `maxAge` is set to `60000` (one minute), and 30 seconds - * has elapsed it will return `30000` until the current request has completed, - * at which time `req.session.touch()` is called to reset `req.session.maxAge` - * to its original value. - * - * req.session.cookie.maxAge; - * // => 30000 - * - * Session Store Implementation: - * - * Every session store _must_ implement the following methods - * - * - `.get(sid, callback)` - * - `.set(sid, session, callback)` - * - `.destroy(sid, callback)` - * - * Recommended methods include, but are not limited to: - * - * - `.length(callback)` - * - `.clear(callback)` - * - * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -function session(options){ - var options = options || {} - , key = options.key || 'connect.sid' - , store = options.store || new MemoryStore - , cookie = options.cookie || {} - , trustProxy = options.proxy - , storeReady = true - , rollingSessions = options.rolling || false; - - // notify user that this store is not - // meant for a production environment - if ('production' == env && store instanceof MemoryStore) { - console.warn(warning); - } - - // generates the new session - store.generate = function(req){ - req.sessionID = uid(24); - req.session = new Session(req); - req.session.cookie = new Cookie(cookie); - }; - - store.on('disconnect', function(){ storeReady = false; }); - store.on('connect', function(){ storeReady = true; }); - - return function session(req, res, next) { - // self-awareness - if (req.session) return next(); - - // Handle connection as if there is no session if - // the store has temporarily disconnected etc - if (!storeReady) return debug('store is disconnected'), next(); - - // pathname mismatch - var originalPath = parse(req.originalUrl).pathname; - if (0 != originalPath.indexOf(cookie.path || '/')) return next(); - - // backwards compatibility for signed cookies - // req.secret is passed from the cookie parser middleware - var secret = options.secret || req.secret; - - // ensure secret is available or bail - if (!secret) throw new Error('`secret` option required for sessions'); - - var originalHash - , originalId; - - // expose store - req.sessionStore = store; - - // grab the session cookie value and check the signature - var rawCookie = req.cookies[key]; - - // get signedCookies for backwards compat with signed cookies - var unsignedCookie = req.signedCookies[key]; - - if (!unsignedCookie && rawCookie) { - unsignedCookie = utils.parseSignedCookie(rawCookie, secret); - } - - // set-cookie - res.on('header', function(){ - if (!req.session) return; - var cookie = req.session.cookie - , proto = (req.headers['x-forwarded-proto'] || '').split(',')[0].toLowerCase().trim() - , tls = req.connection.encrypted || (trustProxy && 'https' == proto) - , isNew = unsignedCookie != req.sessionID; - - // only send secure cookies via https - if (cookie.secure && !tls) return debug('not secured'); - - // in case of rolling session, always reset the cookie - if (!rollingSessions) { - - // browser-session length cookie - if (null == cookie.expires) { - if (!isNew) return debug('already set browser-session cookie'); - // compare hashes and ids - } else if (originalHash == hash(req.session) && originalId == req.session.id) { - return debug('unmodified session'); - } - - } - - var val = 's:' + signature.sign(req.sessionID, secret); - val = cookie.serialize(key, val); - debug('set-cookie %s', val); - res.setHeader('Set-Cookie', val); - }); - - // proxy end() to commit the session - var end = res.end; - res.end = function(data, encoding){ - res.end = end; - if (!req.session) return res.end(data, encoding); - debug('saving'); - req.session.resetMaxAge(); - req.session.save(function(err){ - if (err) console.error(err.stack); - debug('saved'); - res.end(data, encoding); - }); - }; - - // generate the session - function generate() { - store.generate(req); - } - - // get the sessionID from the cookie - req.sessionID = unsignedCookie; - - // generate a session if the browser doesn't send a sessionID - if (!req.sessionID) { - debug('no SID sent, generating session'); - generate(); - next(); - return; - } - - // generate the session object - var pause = utils.pause(req); - debug('fetching %s', req.sessionID); - store.get(req.sessionID, function(err, sess){ - // proxy to resume() events - var _next = next; - next = function(err){ - _next(err); - pause.resume(); - }; - - // error handling - if (err) { - debug('error %j', err); - if ('ENOENT' == err.code) { - generate(); - next(); - } else { - next(err); - } - // no session - } else if (!sess) { - debug('no session found'); - generate(); - next(); - // populate req.session - } else { - debug('session found'); - store.createSession(req, sess); - originalId = req.sessionID; - originalHash = hash(sess); - next(); - } - }); - }; -}; - -/** - * Hash the given `sess` object omitting changes - * to `.cookie`. - * - * @param {Object} sess - * @return {String} - * @api private - */ - -function hash(sess) { - return crc32.signed(JSON.stringify(sess, function(key, val){ - if ('cookie' != key) return val; - })); -} diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js deleted file mode 100644 index 3125410d..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js +++ /dev/null @@ -1,128 +0,0 @@ - -/*! - * Connect - session - Cookie - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../../utils') - , cookie = require('cookie'); - -/** - * Initialize a new `Cookie` with the given `options`. - * - * @param {IncomingMessage} req - * @param {Object} options - * @api private - */ - -var Cookie = module.exports = function Cookie(options) { - this.path = '/'; - this.maxAge = null; - this.httpOnly = true; - if (options) utils.merge(this, options); - this.originalMaxAge = undefined == this.originalMaxAge - ? this.maxAge - : this.originalMaxAge; -}; - -/*! - * Prototype. - */ - -Cookie.prototype = { - - /** - * Set expires `date`. - * - * @param {Date} date - * @api public - */ - - set expires(date) { - this._expires = date; - this.originalMaxAge = this.maxAge; - }, - - /** - * Get expires `date`. - * - * @return {Date} - * @api public - */ - - get expires() { - return this._expires; - }, - - /** - * Set expires via max-age in `ms`. - * - * @param {Number} ms - * @api public - */ - - set maxAge(ms) { - this.expires = 'number' == typeof ms - ? new Date(Date.now() + ms) - : ms; - }, - - /** - * Get expires max-age in `ms`. - * - * @return {Number} - * @api public - */ - - get maxAge() { - return this.expires instanceof Date - ? this.expires.valueOf() - Date.now() - : this.expires; - }, - - /** - * Return cookie data object. - * - * @return {Object} - * @api private - */ - - get data() { - return { - originalMaxAge: this.originalMaxAge - , expires: this._expires - , secure: this.secure - , httpOnly: this.httpOnly - , domain: this.domain - , path: this.path - } - }, - - /** - * Return a serialized cookie string. - * - * @return {String} - * @api public - */ - - serialize: function(name, val){ - return cookie.serialize(name, val, this.data); - }, - - /** - * Return JSON representation of this cookie. - * - * @return {Object} - * @api private - */ - - toJSON: function(){ - return this.data; - } -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/session/memory.js deleted file mode 100644 index fb939392..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/memory.js +++ /dev/null @@ -1,129 +0,0 @@ - -/*! - * Connect - session - MemoryStore - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Store = require('./store'); - -/** - * Initialize a new `MemoryStore`. - * - * @api public - */ - -var MemoryStore = module.exports = function MemoryStore() { - this.sessions = {}; -}; - -/** - * Inherit from `Store.prototype`. - */ - -MemoryStore.prototype.__proto__ = Store.prototype; - -/** - * Attempt to fetch session by the given `sid`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.get = function(sid, fn){ - var self = this; - process.nextTick(function(){ - var expires - , sess = self.sessions[sid]; - if (sess) { - sess = JSON.parse(sess); - expires = 'string' == typeof sess.cookie.expires - ? new Date(sess.cookie.expires) - : sess.cookie.expires; - if (!expires || new Date < expires) { - fn(null, sess); - } else { - self.destroy(sid, fn); - } - } else { - fn(); - } - }); -}; - -/** - * Commit the given `sess` object associated with the given `sid`. - * - * @param {String} sid - * @param {Session} sess - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.set = function(sid, sess, fn){ - var self = this; - process.nextTick(function(){ - self.sessions[sid] = JSON.stringify(sess); - fn && fn(); - }); -}; - -/** - * Destroy the session associated with the given `sid`. - * - * @param {String} sid - * @api public - */ - -MemoryStore.prototype.destroy = function(sid, fn){ - var self = this; - process.nextTick(function(){ - delete self.sessions[sid]; - fn && fn(); - }); -}; - -/** - * Invoke the given callback `fn` with all active sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.all = function(fn){ - var arr = [] - , keys = Object.keys(this.sessions); - for (var i = 0, len = keys.length; i < len; ++i) { - arr.push(this.sessions[keys[i]]); - } - fn(null, arr); -}; - -/** - * Clear all sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.clear = function(fn){ - this.sessions = {}; - fn && fn(); -}; - -/** - * Fetch number of sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.length = function(fn){ - fn(null, Object.keys(this.sessions).length); -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/session/session.js deleted file mode 100644 index 0dd4b400..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/session.js +++ /dev/null @@ -1,116 +0,0 @@ - -/*! - * Connect - session - Session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../../utils'); - -/** - * Create a new `Session` with the given request and `data`. - * - * @param {IncomingRequest} req - * @param {Object} data - * @api private - */ - -var Session = module.exports = function Session(req, data) { - Object.defineProperty(this, 'req', { value: req }); - Object.defineProperty(this, 'id', { value: req.sessionID }); - if ('object' == typeof data) utils.merge(this, data); -}; - -/** - * Update reset `.cookie.maxAge` to prevent - * the cookie from expiring when the - * session is still active. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.touch = function(){ - return this.resetMaxAge(); -}; - -/** - * Reset `.maxAge` to `.originalMaxAge`. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.resetMaxAge = function(){ - this.cookie.maxAge = this.cookie.originalMaxAge; - return this; -}; - -/** - * Save the session data with optional callback `fn(err)`. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.save = function(fn){ - this.req.sessionStore.set(this.id, this, fn || function(){}); - return this; -}; - -/** - * Re-loads the session data _without_ altering - * the maxAge properties. Invokes the callback `fn(err)`, - * after which time if no exception has occurred the - * `req.session` property will be a new `Session` object, - * although representing the same session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.reload = function(fn){ - var req = this.req - , store = this.req.sessionStore; - store.get(this.id, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(new Error('failed to load session')); - store.createSession(req, sess); - fn(); - }); - return this; -}; - -/** - * Destroy `this` session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.destroy = function(fn){ - delete this.req.session; - this.req.sessionStore.destroy(this.id, fn); - return this; -}; - -/** - * Regenerate this request's session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.regenerate = function(fn){ - this.req.sessionStore.regenerate(this.req, fn); - return this; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/session/store.js deleted file mode 100644 index 54294cbd..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/session/store.js +++ /dev/null @@ -1,84 +0,0 @@ - -/*! - * Connect - session - Store - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , Session = require('./session') - , Cookie = require('./cookie'); - -/** - * Initialize abstract `Store`. - * - * @api private - */ - -var Store = module.exports = function Store(options){}; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Store.prototype.__proto__ = EventEmitter.prototype; - -/** - * Re-generate the given requests's session. - * - * @param {IncomingRequest} req - * @return {Function} fn - * @api public - */ - -Store.prototype.regenerate = function(req, fn){ - var self = this; - this.destroy(req.sessionID, function(err){ - self.generate(req); - fn(err); - }); -}; - -/** - * Load a `Session` instance via the given `sid` - * and invoke the callback `fn(err, sess)`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -Store.prototype.load = function(sid, fn){ - var self = this; - this.get(sid, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(); - var req = { sessionID: sid, sessionStore: self }; - sess = self.createSession(req, sess); - fn(null, sess); - }); -}; - -/** - * Create session from JSON `sess` data. - * - * @param {IncomingRequest} req - * @param {Object} sess - * @return {Session} - * @api private - */ - -Store.prototype.createSession = function(req, sess){ - var expires = sess.cookie.expires - , orig = sess.cookie.originalMaxAge; - sess.cookie = new Cookie(sess.cookie); - if ('string' == typeof expires) sess.cookie.expires = new Date(expires); - sess.cookie.originalMaxAge = orig; - req.session = new Session(req, sess); - return req.session; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/static.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/static.js deleted file mode 100644 index 67970dab..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/static.js +++ /dev/null @@ -1,102 +0,0 @@ -/*! - * Connect - static - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var send = require('send') - , utils = require('../utils') - , parse = utils.parseUrl - , url = require('url'); - -/** - * Static: - * - * Static file server with the given `root` path. - * - * Examples: - * - * var oneDay = 86400000; - * - * connect() - * .use(connect.static(__dirname + '/public')) - * - * connect() - * .use(connect.static(__dirname + '/public', { maxAge: oneDay })) - * - * Options: - * - * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0 - * - `hidden` Allow transfer of hidden files. defaults to false - * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true - * - `index` Default file name, defaults to 'index.html' - * - * @param {String} root - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(root, options){ - options = options || {}; - - // root required - if (!root) throw new Error('static() root path required'); - - // default redirect - var redirect = false !== options.redirect; - - return function staticMiddleware(req, res, next) { - if ('GET' != req.method && 'HEAD' != req.method) return next(); - var originalUrl = url.parse(req.originalUrl); - var path = parse(req).pathname; - var pause = utils.pause(req); - - if (path == '/' && originalUrl.pathname[originalUrl.pathname.length - 1] != '/') { - return directory(); - } - - function resume() { - next(); - pause.resume(); - } - - function directory() { - if (!redirect) return resume(); - var target; - originalUrl.pathname += '/'; - target = url.format(originalUrl); - res.statusCode = 303; - res.setHeader('Location', target); - res.end('Redirecting to ' + utils.escape(target)); - } - - function error(err) { - if (404 == err.status) return resume(); - next(err); - } - - send(req, path) - .maxage(options.maxAge || 0) - .root(root) - .index(options.index || 'index.html') - .hidden(options.hidden) - .on('error', error) - .on('directory', directory) - .pipe(res); - }; -}; - -/** - * Expose mime module. - * - * If you wish to extend the mime table use this - * reference to the "mime" module in the npm registry. - */ - -exports.mime = send.mime; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/staticCache.js deleted file mode 100644 index 66d3c1f6..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/staticCache.js +++ /dev/null @@ -1,238 +0,0 @@ - -/*! - * Connect - staticCache - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , Cache = require('../cache') - , fresh = require('fresh'); - -/** - * Static cache: - * - * Status: Deprecated. This middleware will be removed in - * Connect 3.0. You may be interested in: - * - * - [st](https://github.com/isaacs/st) - * - * Enables a memory cache layer on top of - * the `static()` middleware, serving popular - * static files. - * - * By default a maximum of 128 objects are - * held in cache, with a max of 256k each, - * totalling ~32mb. - * - * A Least-Recently-Used (LRU) cache algo - * is implemented through the `Cache` object, - * simply rotating cache objects as they are - * hit. This means that increasingly popular - * objects maintain their positions while - * others get shoved out of the stack and - * garbage collected. - * - * Benchmarks: - * - * static(): 2700 rps - * node-static: 5300 rps - * static() + staticCache(): 7500 rps - * - * Options: - * - * - `maxObjects` max cache objects [128] - * - `maxLength` max cache object length 256kb - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function staticCache(options){ - var options = options || {} - , cache = new Cache(options.maxObjects || 128) - , maxlen = options.maxLength || 1024 * 256; - - if (process.env.NODE_ENV !== 'test') { - console.warn('connect.staticCache() is deprecated and will be removed in 3.0'); - console.warn('use varnish or similar reverse proxy caches.'); - } - - return function staticCache(req, res, next){ - var key = cacheKey(req) - , ranges = req.headers.range - , hasCookies = req.headers.cookie - , hit = cache.get(key); - - // cache static - // TODO: change from staticCache() -> cache() - // and make this work for any request - req.on('static', function(stream){ - var headers = res._headers - , cc = utils.parseCacheControl(headers['cache-control'] || '') - , contentLength = headers['content-length'] - , hit; - - // dont cache set-cookie responses - if (headers['set-cookie']) return hasCookies = true; - - // dont cache when cookies are present - if (hasCookies) return; - - // ignore larger files - if (!contentLength || contentLength > maxlen) return; - - // don't cache partial files - if (headers['content-range']) return; - - // dont cache items we shouldn't be - // TODO: real support for must-revalidate / no-cache - if ( cc['no-cache'] - || cc['no-store'] - || cc['private'] - || cc['must-revalidate']) return; - - // if already in cache then validate - if (hit = cache.get(key)){ - if (headers.etag == hit[0].etag) { - hit[0].date = new Date; - return; - } else { - cache.remove(key); - } - } - - // validation notifiactions don't contain a steam - if (null == stream) return; - - // add the cache object - var arr = []; - - // store the chunks - stream.on('data', function(chunk){ - arr.push(chunk); - }); - - // flag it as complete - stream.on('end', function(){ - var cacheEntry = cache.add(key); - delete headers['x-cache']; // Clean up (TODO: others) - cacheEntry.push(200); - cacheEntry.push(headers); - cacheEntry.push.apply(cacheEntry, arr); - }); - }); - - if (req.method == 'GET' || req.method == 'HEAD') { - if (ranges) { - next(); - } else if (!hasCookies && hit && !mustRevalidate(req, hit)) { - res.setHeader('X-Cache', 'HIT'); - respondFromCache(req, res, hit); - } else { - res.setHeader('X-Cache', 'MISS'); - next(); - } - } else { - next(); - } - } -}; - -/** - * Respond with the provided cached value. - * TODO: Assume 200 code, that's iffy. - * - * @param {Object} req - * @param {Object} res - * @param {Object} cacheEntry - * @return {String} - * @api private - */ - -function respondFromCache(req, res, cacheEntry) { - var status = cacheEntry[0] - , headers = utils.merge({}, cacheEntry[1]) - , content = cacheEntry.slice(2); - - headers.age = (new Date - new Date(headers.date)) / 1000 || 0; - - switch (req.method) { - case 'HEAD': - res.writeHead(status, headers); - res.end(); - break; - case 'GET': - if (utils.conditionalGET(req) && fresh(req.headers, headers)) { - headers['content-length'] = 0; - res.writeHead(304, headers); - res.end(); - } else { - res.writeHead(status, headers); - - function write() { - while (content.length) { - if (false === res.write(content.shift())) { - res.once('drain', write); - return; - } - } - res.end(); - } - - write(); - } - break; - default: - // This should never happen. - res.writeHead(500, ''); - res.end(); - } -} - -/** - * Determine whether or not a cached value must be revalidated. - * - * @param {Object} req - * @param {Object} cacheEntry - * @return {String} - * @api private - */ - -function mustRevalidate(req, cacheEntry) { - var cacheHeaders = cacheEntry[1] - , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '') - , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '') - , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0; - - if ( cacheCC['no-cache'] - || cacheCC['must-revalidate'] - || cacheCC['proxy-revalidate']) return true; - - if (reqCC['no-cache']) return true; - - if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge; - - if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge; - - return false; -} - -/** - * The key to use in the cache. For now, this is the URL path and query. - * - * 'http://example.com?key=value' -> '/?key=value' - * - * @param {Object} req - * @return {String} - * @api private - */ - -function cacheKey(req) { - return utils.parseUrl(req).path; -} diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/timeout.js deleted file mode 100644 index 5496c024..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/timeout.js +++ /dev/null @@ -1,55 +0,0 @@ -/*! - * Connect - timeout - * Ported from https://github.com/LearnBoost/connect-timeout - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var debug = require('debug')('connect:timeout'); - -/** - * Timeout: - * - * Times out the request in `ms`, defaulting to `5000`. The - * method `req.clearTimeout()` is added to revert this behaviour - * programmatically within your application's middleware, routes, etc. - * - * The timeout error is passed to `next()` so that you may customize - * the response behaviour. This error has the `.timeout` property as - * well as `.status == 503`. - * - * @param {Number} ms - * @return {Function} - * @api public - */ - -module.exports = function timeout(ms) { - ms = ms || 5000; - - return function(req, res, next) { - var id = setTimeout(function(){ - req.emit('timeout', ms); - }, ms); - - req.on('timeout', function(){ - if (res.headerSent) return debug('response started, cannot timeout'); - var err = new Error('Response timeout'); - err.timeout = ms; - err.status = 503; - next(err); - }); - - req.clearTimeout = function(){ - clearTimeout(id); - }; - - res.on('header', function(){ - clearTimeout(id); - }); - - next(); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js deleted file mode 100644 index ebc6f5fc..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js +++ /dev/null @@ -1,77 +0,0 @@ - -/*! - * Connect - urlencoded - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); -var getBody = require('raw-body'); -var qs = require('qs'); - -/** - * Urlencoded: - * - * Parse x-ww-form-urlencoded request bodies, - * providing the parsed object as `req.body` using - * [qs](https://github.com/visionmedia/node-querystring). - * - * Options: - * - * - `limit` byte limit [1mb] - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - var verify = typeof options.verify === 'function' && options.verify; - - return function urlencoded(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - - if (!utils.hasBody(req)) return next(); - - // check Content-Type - if ('application/x-www-form-urlencoded' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - getBody(req, { - limit: options.limit || '1mb', - length: req.headers['content-length'], - encoding: 'utf8' - }, function (err, buf) { - if (err) return next(err); - - if (verify) { - try { - verify(req, res, buf) - } catch (err) { - if (!err.status) err.status = 403; - return next(err); - } - } - - try { - req.body = buf.length - ? qs.parse(buf, options) - : {}; - } catch (err){ - err.body = buf; - return next(err); - } - next(); - }) - } -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/realtime/node_modules/express/node_modules/connect/lib/middleware/vhost.js deleted file mode 100644 index abbb0500..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/middleware/vhost.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * Connect - vhost - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Vhost: - * - * Setup vhost for the given `hostname` and `server`. - * - * connect() - * .use(connect.vhost('foo.com', fooApp)) - * .use(connect.vhost('bar.com', barApp)) - * .use(connect.vhost('*.com', mainApp)) - * - * The `server` may be a Connect server or - * a regular Node `http.Server`. - * - * @param {String} hostname - * @param {Server} server - * @return {Function} - * @api public - */ - -module.exports = function vhost(hostname, server){ - if (!hostname) throw new Error('vhost hostname required'); - if (!server) throw new Error('vhost server required'); - var regexp = new RegExp('^' + hostname.replace(/[^*\w]/g, '\\$&').replace(/[*]/g, '(?:.*?)') + '$', 'i'); - if (server.onvhost) server.onvhost(hostname); - return function vhost(req, res, next){ - if (!req.headers.host) return next(); - var host = req.headers.host.split(':')[0]; - if (!regexp.test(host)) return next(); - if ('function' == typeof server) return server(req, res, next); - server.emit('request', req, res); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/patch.js b/realtime/node_modules/express/node_modules/connect/lib/patch.js deleted file mode 100644 index 22bcbc62..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/patch.js +++ /dev/null @@ -1,89 +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)) { - if (Array.isArray(prev)) { - val = prev.concat(val); - } else if (Array.isArray(val)) { - val = val.concat(prev); - } else { - 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(statusCode, reasonPhrase, headers){ - if (typeof reasonPhrase === 'object') headers = reasonPhrase; - if (typeof headers === 'object') { - Object.keys(headers).forEach(function(key){ - this.setHeader(key, headers[key]); - }, this); - } - if (!this._emittedHeader) this.emit('header'); - this._emittedHeader = true; - return writeHead.call(this, statusCode, reasonPhrase); - }; - - res._hasConnectPatch = true; -} diff --git a/realtime/node_modules/express/node_modules/connect/lib/proto.js b/realtime/node_modules/express/node_modules/connect/lib/proto.js deleted file mode 100644 index a945bc28..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/proto.js +++ /dev/null @@ -1,233 +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 - , search = 1 + req.url.indexOf('?') - , pathlength = search ? search - 1 : req.url.length - , fqdn = 1 + req.url.substr(0, pathlength).indexOf('://') - , protohost = fqdn ? req.url.substr(0, req.url.indexOf('/', 2 + fqdn)) : '' - , removed = '' - , slashAdded = false - , index = 0; - - function next(err) { - var layer, path, c; - - if (slashAdded) { - req.url = req.url.substr(1); - slashAdded = false; - } - - req.url = protohost + removed + req.url.substr(protohost.length); - 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(); - msg = utils.escape(msg); - - // 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/html'); - 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/html'); - if ('HEAD' == req.method) return res.end(); - res.end('Cannot ' + utils.escape(req.method) + ' ' + utils.escape(req.originalUrl) + '\n'); - } - return; - } - - try { - path = utils.parseUrl(req).pathname; - if (undefined == path) path = '/'; - - // skip this layer if the route doesn't match. - if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err); - - c = path[layer.route.length]; - if (c && '/' != c && '.' != c) return next(err); - - // Call the layer handler - // Trim off the part of the url that matches the route - removed = layer.route; - req.url = protohost + req.url.substr(protohost.length + removed.length); - - // Ensure leading slash - if (!fqdn && '/' != req.url[0]) { - req.url = '/' + req.url; - slashAdded = true; - } - - debug('%s %s : %s', layer.handle.name || 'anonymous', layer.route, req.originalUrl); - var arity = layer.handle.length; - if (err) { - if (arity === 4) { - layer.handle(err, req, res, next); - } else { - next(err); - } - } else if (arity < 4) { - layer.handle(req, res, next); - } else { - next(); - } - } catch (e) { - next(e); - } - } - next(); -}; - -/** - * Listen for connections. - * - * This method takes the same arguments - * as node's `http.Server#listen()`. - * - * HTTP and HTTPS: - * - * If you run your application both as HTTP - * and HTTPS you may wrap them individually, - * since your Connect "server" is really just - * a JavaScript `Function`. - * - * var connect = require('connect') - * , http = require('http') - * , https = require('https'); - * - * var app = connect(); - * - * http.createServer(app).listen(80); - * https.createServer(options, app).listen(443); - * - * @return {http.Server} - * @api public - */ - -app.listen = function(){ - var server = http.createServer(this); - return server.listen.apply(server, arguments); -}; diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/directory.html b/realtime/node_modules/express/node_modules/connect/lib/public/directory.html deleted file mode 100644 index 8ed8b4ae..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/public/directory.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - listing directory {directory} - - - - - -
    -

    {linked-path}

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

    {title}

    -

    {statusCode} {error}

    -
      {stack}
    -
    - - diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/favicon.ico b/realtime/node_modules/express/node_modules/connect/lib/public/favicon.ico deleted file mode 100644 index 895fc96a..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/favicon.ico and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/folder.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/folder.png deleted file mode 100644 index 698f3d30..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/folder.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page.png deleted file mode 100644 index 03ddd799..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_add.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_add.png deleted file mode 100644 index d5bfa071..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_add.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png deleted file mode 100644 index 89ee2da0..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_code.png deleted file mode 100644 index f7ea9041..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_code.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png deleted file mode 100644 index 195dc6d6..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png deleted file mode 100644 index 3141467c..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png deleted file mode 100644 index 046811ed..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_error.png deleted file mode 100644 index f07f449a..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_error.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png deleted file mode 100644 index eb6158eb..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_find.png deleted file mode 100644 index 2f193889..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_find.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png deleted file mode 100644 index 8e83281c..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_go.png deleted file mode 100644 index 80fe1ed0..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_go.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_green.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_green.png deleted file mode 100644 index de8e003f..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_green.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_key.png deleted file mode 100644 index d6626cb0..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_key.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png deleted file mode 100644 index 7e568703..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_link.png deleted file mode 100644 index 312eab09..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_link.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png deleted file mode 100644 index 246a2f0b..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png deleted file mode 100644 index 968f073f..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_red.png deleted file mode 100644 index 0b18247d..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_red.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png deleted file mode 100644 index cf347c7d..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_save.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_save.png deleted file mode 100644 index caea546a..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_save.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white.png deleted file mode 100644 index 8b8b1ca0..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png deleted file mode 100644 index 8f8095e4..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png deleted file mode 100644 index 159b2407..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png deleted file mode 100644 index aa23dde3..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png deleted file mode 100644 index 34a05ccc..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png deleted file mode 100644 index f501a593..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png deleted file mode 100644 index 848bdaf3..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png deleted file mode 100644 index 0c76bd12..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png deleted file mode 100644 index 87a69145..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png deleted file mode 100644 index c66011fb..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png deleted file mode 100644 index 2b6b1007..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png deleted file mode 100644 index a9f31a27..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png deleted file mode 100644 index a87cf847..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png deleted file mode 100644 index ffb8fc93..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png deleted file mode 100644 index 0a7d6f4a..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png deleted file mode 100644 index bddba1f9..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png deleted file mode 100644 index af1ecaf2..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png deleted file mode 100644 index 4cc537af..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png deleted file mode 100644 index b93e7760..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png deleted file mode 100644 index 9fc5a0a1..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png deleted file mode 100644 index b977d7e5..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png deleted file mode 100644 index 58184363..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png deleted file mode 100644 index 5769120b..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png deleted file mode 100644 index 8d719df5..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png deleted file mode 100644 index 106f5aa3..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png deleted file mode 100644 index e4a1ecba..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png deleted file mode 100644 index 7e62a924..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png deleted file mode 100644 index e902abb0..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png deleted file mode 100644 index 1d2d0a49..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png deleted file mode 100644 index d6164845..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png deleted file mode 100644 index 7215d1e8..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png deleted file mode 100644 index bf7bd1c9..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png deleted file mode 100644 index f6b74cc4..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png deleted file mode 100644 index d3fffb6d..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png deleted file mode 100644 index a65bcb3e..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png deleted file mode 100644 index 23a37b89..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png deleted file mode 100644 index f907e44b..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png deleted file mode 100644 index 5b2cbb3f..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png deleted file mode 100644 index 7868a259..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png deleted file mode 100644 index 134b6693..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png deleted file mode 100644 index c4eff038..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png deleted file mode 100644 index 884ffd6f..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png deleted file mode 100644 index f59b7c43..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png deleted file mode 100644 index 44084add..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png deleted file mode 100644 index 3a1441c9..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png deleted file mode 100644 index e7708292..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png deleted file mode 100644 index 813f712f..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png deleted file mode 100644 index d9cf1325..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png deleted file mode 100644 index 52699bfe..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png deleted file mode 100644 index 4a05955b..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png deleted file mode 100644 index a0a433df..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png deleted file mode 100644 index 1eb88094..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png deleted file mode 100644 index ae8ecbf4..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png deleted file mode 100644 index 6ed2490e..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png deleted file mode 100644 index fecadd08..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png deleted file mode 100644 index fd4bbccd..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_word.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_word.png deleted file mode 100644 index 834cdfaf..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_word.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_world.png b/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_world.png deleted file mode 100644 index b8895dde..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/lib/public/icons/page_world.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/lib/public/style.css b/realtime/node_modules/express/node_modules/connect/lib/public/style.css deleted file mode 100644 index 0709908a..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/public/style.css +++ /dev/null @@ -1,257 +0,0 @@ -* { - margin: 0; - padding: 0; - outline: 0; -} - -body { - 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 { - 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 li { - 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: 100%; - overflow: hidden; -} -ul#files li { - float: left; - width: 30%; - line-height: 25px; - margin: 1px; -} -ul#files li a { - display: block; - height: 25px; - border: 1px solid transparent; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - overflow: hidden; - white-space: nowrap; -} -ul#files li a:focus, -ul#files li a:hover { - 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; -} - -/*views*/ -#files span { - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - text-indent: 10px; -} -#files .name { - background-repeat: no-repeat; -} -#files .icon .name { - text-indent: 28px; -} - -/*tiles*/ -.view-tiles .name { - width: 100%; - background-position: 8px 5px; -} -.view-tiles .size, -.view-tiles .date { - display: none; -} - -/*details*/ -ul#files.view-details li { - float: none; - display: block; - width: 90%; -} -ul#files.view-details li.header { - height: 25px; - background: #000; - color: #fff; - font-weight: bold; -} -.view-details .header { - border-radius: 5px; -} -.view-details .name { - width: 60%; - background-position: 8px 5px; -} -.view-details .size { - width: 10%; -} -.view-details .date { - width: 30%; -} -.view-details .size, -.view-details .date { - text-align: right; - direction: rtl; -} - -/*mobile*/ -@media (max-width: 768px) { - body { - font-size: 13px; - line-height: 16px; - padding: 0; - } - #search { - position: static; - width: 100%; - font-size: 2em; - line-height: 1.8em; - text-indent: 10px; - border: 0; - border-radius: 0; - padding: 10px 0; - margin: 0; - } - #search:focus { - width: 100%; - border: 0; - opacity: 1; - } - .directory h1 { - font-size: 2em; - line-height: 1.5em; - color: #fff; - background: #000; - padding: 15px 10px; - margin: 0; - } - ul#files { - border-top: 1px solid #cacaca; - } - ul#files li { - float: none; - width: auto !important; - display: block; - border-bottom: 1px solid #cacaca; - font-size: 2em; - line-height: 1.2em; - text-indent: 0; - margin: 0; - } - ul#files li:nth-child(odd) { - background: #e0e0e0; - } - ul#files li a { - height: auto; - border: 0; - border-radius: 0; - padding: 15px 10px; - } - ul#files li a:focus, - ul#files li a:hover { - border: 0; - } - #files .header, - #files .size, - #files .date { - display: none !important; - } - #files .name { - float: none; - display: inline-block; - width: 100%; - text-indent: 0; - background-position: 0 0; - } - #files .icon .name { - text-indent: 41px; - } -} diff --git a/realtime/node_modules/express/node_modules/connect/lib/utils.js b/realtime/node_modules/express/node_modules/connect/lib/utils.js deleted file mode 100644 index 9839bc33..00000000 --- a/realtime/node_modules/express/node_modules/connect/lib/utils.js +++ /dev/null @@ -1,408 +0,0 @@ - -/*! - * Connect - utils - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , crypto = require('crypto') - , parse = require('url').parse - , sep = require('path').sep - , signature = require('cookie-signature') - , nodeVersion = process.versions.node.split('.'); - -// pause is broken in node < 0.10 -exports.brokenPause = parseInt(nodeVersion[0], 10) === 0 - && parseInt(nodeVersion[1], 10) < 10; - -/** - * Return `true` if the request has a body, otherwise return `false`. - * - * @param {IncomingMessage} req - * @return {Boolean} - * @api private - */ - -exports.hasBody = function(req) { - var encoding = 'transfer-encoding' in req.headers; - var length = 'content-length' in req.headers && req.headers['content-length'] !== '0'; - return encoding || length; -}; - -/** - * Extract the mime type from the given request's - * _Content-Type_ header. - * - * @param {IncomingMessage} req - * @return {String} - * @api private - */ - -exports.mime = function(req) { - var str = req.headers['content-type'] || ''; - return str.split(';')[0]; -}; - -/** - * Generate an `Error` from the given status `code` - * and optional `msg`. - * - * @param {Number} code - * @param {String} msg - * @return {Error} - * @api private - */ - -exports.error = function(code, msg){ - var err = new Error(msg || http.STATUS_CODES[code]); - err.status = code; - return err; -}; - -/** - * Return md5 hash of the given string and optional encoding, - * defaulting to hex. - * - * utils.md5('wahoo'); - * // => "e493298061761236c96b02ea6aa8a2ad" - * - * @param {String} str - * @param {String} encoding - * @return {String} - * @api private - */ - -exports.md5 = function(str, encoding){ - return crypto - .createHash('md5') - .update(str, 'utf8') - .digest(encoding || 'hex'); -}; - -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * utils.merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api private - */ - -exports.merge = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String} secret - * @return {String} - * @api private - */ - -exports.sign = function(val, secret){ - console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature') - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/=+$/, ''); -}; - -/** - * Unsign and decode the given `val` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} val - * @param {String} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(val, secret){ - console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature') - var str = val.slice(0, val.lastIndexOf('.')); - return exports.sign(str, secret) == val - ? str - : false; -}; - -/** - * Parse signed cookies, returning an object - * containing the decoded key/value pairs, - * while removing the signed key from `obj`. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.parseSignedCookies = function(obj, secret){ - var ret = {}; - Object.keys(obj).forEach(function(key){ - var val = obj[key]; - if (0 == val.indexOf('s:')) { - val = signature.unsign(val.slice(2), secret); - if (val) { - ret[key] = val; - delete obj[key]; - } - } - }); - return ret; -}; - -/** - * Parse a signed cookie string, return the decoded value - * - * @param {String} str signed cookie string - * @param {String} secret - * @return {String} decoded value - * @api private - */ - -exports.parseSignedCookie = function(str, secret){ - return 0 == str.indexOf('s:') - ? signature.unsign(str.slice(2), secret) - : str; -}; - -/** - * Parse JSON cookies. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.parseJSONCookies = function(obj){ - Object.keys(obj).forEach(function(key){ - var val = obj[key]; - var res = exports.parseJSONCookie(val); - if (res) obj[key] = res; - }); - return obj; -}; - -/** - * Parse JSON cookie string - * - * @param {String} str - * @return {Object} Parsed object or null if not json cookie - * @api private - */ - -exports.parseJSONCookie = function(str) { - if (0 == str.indexOf('j:')) { - try { - return JSON.parse(str.slice(2)); - } catch (err) { - // no op - } - } -}; - -/** - * Pause `data` and `end` events on the given `obj`. - * Middleware performing async tasks _should_ utilize - * this utility (or similar), to re-emit data once - * the async operation has completed, otherwise these - * events may be lost. Pause is only required for - * node versions less than 10, and is replaced with - * noop's otherwise. - * - * var pause = utils.pause(req); - * fs.readFile(path, function(){ - * next(); - * pause.resume(); - * }); - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.pause = exports.brokenPause - ? require('pause') - : function () { - return { - end: noop, - resume: noop - } - } - -/** - * Strip `Content-*` headers from `res`. - * - * @param {ServerResponse} res - * @api private - */ - -exports.removeContentHeaders = function(res){ - if (!res._headers) return; - Object.keys(res._headers).forEach(function(field){ - if (0 == field.indexOf('content')) { - res.removeHeader(field); - } - }); -}; - -/** - * Check if `req` is a conditional GET request. - * - * @param {IncomingMessage} req - * @return {Boolean} - * @api private - */ - -exports.conditionalGET = function(req) { - return req.headers['if-modified-since'] - || req.headers['if-none-match']; -}; - -/** - * Respond with 401 "Unauthorized". - * - * @param {ServerResponse} res - * @param {String} realm - * @api private - */ - -exports.unauthorized = function(res, realm) { - res.statusCode = 401; - res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"'); - res.end('Unauthorized'); -}; - -/** - * Respond with 304 "Not Modified". - * - * @param {ServerResponse} res - * @param {Object} headers - * @api private - */ - -exports.notModified = function(res) { - exports.removeContentHeaders(res); - res.statusCode = 304; - res.end(); -}; - -/** - * Return an ETag in the form of `"-"` - * from the given `stat`. - * - * @param {Object} stat - * @return {String} - * @api private - */ - -exports.etag = function(stat) { - return '"' + stat.size + '-' + Number(stat.mtime) + '"'; -}; - -/** - * Parse the given Cache-Control `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - -exports.parseCacheControl = function(str){ - var directives = str.split(',') - , obj = {}; - - for(var i = 0, len = directives.length; i < len; i++) { - var parts = directives[i].split('=') - , key = parts.shift().trim() - , val = parseInt(parts.shift(), 10); - - obj[key] = isNaN(val) ? true : val; - } - - return obj; -}; - -/** - * Parse the `req` url with memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api private - */ - -exports.parseUrl = function(req){ - var parsed = req._parsedUrl; - if (parsed && parsed.href == req.url) { - return parsed; - } else { - parsed = parse(req.url); - - if (parsed.auth && !parsed.protocol && ~parsed.href.indexOf('//')) { - // This parses pathnames, and a strange pathname like //r@e should work - parsed = parse(req.url.replace(/@/g, '%40')); - } - - return req._parsedUrl = parsed; - } -}; - -/** - * Parse byte `size` string. - * - * @param {String} size - * @return {Number} - * @api private - */ - -exports.parseBytes = require('bytes'); - -/** - * Normalizes the path separator from system separator - * to URL separator, aka `/`. - * - * @param {String} path - * @return {String} - * @api private - */ - -exports.normalizeSlashes = function normalizeSlashes(path) { - return path.split(sep).join('/'); -}; - -function noop() {} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/batch/.npmignore deleted file mode 100644 index f1250e58..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/History.md b/realtime/node_modules/express/node_modules/connect/node_modules/batch/History.md deleted file mode 100644 index b1b77526..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/History.md +++ /dev/null @@ -1,66 +0,0 @@ - -0.5.0 / 2013-07-29 -================== - - * add `.throws(true)` to opt-in to responding with an array of error objects - * make `new` optional - -0.4.0 / 2013-06-05 -================== - - * add catching of immediate callback errors - -0.3.2 / 2013-03-15 -================== - - * remove Emitter call in constructor - -0.3.1 / 2013-03-13 -================== - - * add Emitter() mixin for client. Closes #8 - -0.3.0 / 2013-03-13 -================== - - * add component.json - * add result example - * add .concurrency support - * add concurrency example - * add parallel example - -0.2.1 / 2012-11-08 -================== - - * add .start, .end, and .duration properties - * change dependencies to devDependencies - -0.2.0 / 2012-10-04 -================== - - * add progress events. Closes #5 (__BREAKING CHANGE__) - -0.1.1 / 2012-07-03 -================== - - * change "complete" event to "progress" - -0.1.0 / 2012-07-03 -================== - - * add Emitter inheritance and emit "complete" [burcu] - -0.0.3 / 2012-06-02 -================== - - * Callback results should be in the order of the queued functions. - -0.0.2 / 2012-02-12 -================== - - * any node - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/Makefile b/realtime/node_modules/express/node_modules/connect/node_modules/batch/Makefile deleted file mode 100644 index 634e3721..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/Readme.md b/realtime/node_modules/express/node_modules/connect/node_modules/batch/Readme.md deleted file mode 100644 index f2345c67..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/Readme.md +++ /dev/null @@ -1,74 +0,0 @@ - -# batch - - Simple async batch with concurrency control and progress reporting. - -## Installation - -``` -$ npm install batch -``` - -## API - -```js -var Batch = require('batch') - , batch = new Batch; - -batch.concurrency(4); - -ids.forEach(function(id){ - batch.push(function(done){ - User.get(id, done); - }); -}); - -batch.on('progress', function(e){ - -}); - -batch.end(function(err, users){ - -}); -``` - -### Progress events - - Contain the "job" index, response value, duration information, and completion data. - -```js -{ index: 1, - value: 'bar', - pending: 2, - total: 3, - complete: 2, - percent: 66, - start: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT), - end: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT), - duration: 0 } -``` - -## License - -(The MIT License) - -Copyright (c) 2013 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/component.json b/realtime/node_modules/express/node_modules/connect/node_modules/batch/component.json deleted file mode 100644 index 0ea7e582..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/component.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "batch", - "repo": "visionmedia/batch", - "description": "Async task batching", - "version": "0.5.0", - "keywords": ["batch", "async", "utility", "concurrency", "concurrent"], - "dependencies": { - "component/emitter": "*" - }, - "development": {}, - "scripts": [ - "index.js" - ] -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/batch/index.js deleted file mode 100644 index 932d4045..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/index.js +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Module dependencies. - */ - -try { - var EventEmitter = require('events').EventEmitter; -} catch (err) { - var Emitter = require('emitter'); -} - -/** - * Noop. - */ - -function noop(){} - -/** - * Expose `Batch`. - */ - -module.exports = Batch; - -/** - * Create a new Batch. - */ - -function Batch() { - if (!(this instanceof Batch)) return new Batch; - this.fns = []; - this.concurrency(Infinity); - this.throws(true); - for (var i = 0, len = arguments.length; i < len; ++i) { - this.push(arguments[i]); - } -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -if (EventEmitter) { - Batch.prototype.__proto__ = EventEmitter.prototype; -} else { - Emitter(Batch.prototype); -} - -/** - * Set concurrency to `n`. - * - * @param {Number} n - * @return {Batch} - * @api public - */ - -Batch.prototype.concurrency = function(n){ - this.n = n; - return this; -}; - -/** - * Queue a function. - * - * @param {Function} fn - * @return {Batch} - * @api public - */ - -Batch.prototype.push = function(fn){ - this.fns.push(fn); - return this; -}; - -/** - * Set wether Batch will or will not throw up. - * - * @param {Boolean} throws - * @return {Batch} - * @api public - */ -Batch.prototype.throws = function(throws) { - this.e = !!throws; - return this; -}; - -/** - * Execute all queued functions in parallel, - * executing `cb(err, results)`. - * - * @param {Function} cb - * @return {Batch} - * @api public - */ - -Batch.prototype.end = function(cb){ - var self = this - , total = this.fns.length - , pending = total - , results = [] - , errors = [] - , cb = cb || noop - , fns = this.fns - , max = this.n - , throws = this.e - , index = 0 - , done; - - // empty - if (!fns.length) return cb(null, results); - - // process - function next() { - var i = index++; - var fn = fns[i]; - if (!fn) return; - var start = new Date; - - try { - fn(callback); - } catch (err) { - callback(err); - } - - function callback(err, res){ - if (done) return; - if (err && throws) return done = true, cb(err); - var complete = total - pending + 1; - var end = new Date; - - results[i] = res; - errors[i] = err; - - self.emit('progress', { - index: i, - value: res, - error: err, - pending: pending, - total: total, - complete: complete, - percent: complete / total * 100 | 0, - start: start, - end: end, - duration: end - start - }); - - if (--pending) next() - else if(!throws) cb(errors, results); - else cb(null, results); - } - } - - // concurrency - for (var i = 0; i < fns.length; i++) { - if (i == max) break; - next(); - } - - return this; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/batch/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/batch/package.json deleted file mode 100644 index a0a17319..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/batch/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "batch", - "version": "0.5.0", - "description": "Simple async batch", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "main": "index", - "readme": "\n# batch\n\n Simple async batch with concurrency control and progress reporting.\n\n## Installation\n\n```\n$ npm install batch\n```\n\n## API\n\n```js\nvar Batch = require('batch')\n , batch = new Batch;\n\nbatch.concurrency(4);\n\nids.forEach(function(id){\n batch.push(function(done){\n User.get(id, done);\n });\n});\n\nbatch.on('progress', function(e){\n\n});\n\nbatch.end(function(err, users){\n\n});\n```\n\n### Progress events\n\n Contain the \"job\" index, response value, duration information, and completion data.\n\n```js\n{ index: 1,\n value: 'bar',\n pending: 2,\n total: 3,\n complete: 2,\n percent: 66,\n start: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT),\n end: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT),\n duration: 0 }\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2013 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "batch@0.5.0", - "dist": { - "shasum": "ee99813cfbd9be318019bbe6d87217ef186e460c" - }, - "_from": "batch@0.5.0", - "_resolved": "https://registry.npmjs.org/batch/-/batch-0.5.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore deleted file mode 100644 index 9daeafb9..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/History.md deleted file mode 100644 index f233ed16..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/History.md +++ /dev/null @@ -1,15 +0,0 @@ - -0.2.1 / 2013-04-01 -================== - - * add .component - -0.2.0 / 2012-10-28 -================== - - * bytes(200).should.eql('200b') - -0.1.0 / 2012-07-04 -================== - - * add bytes to string conversion [yields] diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/Makefile deleted file mode 100644 index 8e8640f2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --reporter spec \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md deleted file mode 100644 index 9325d5bf..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md +++ /dev/null @@ -1,51 +0,0 @@ -# node-bytes - - Byte string parser / formatter. - -## Example: - -```js -bytes('1kb') -// => 1024 - -bytes('2mb') -// => 2097152 - -bytes('1gb') -// => 1073741824 - -bytes(1073741824) -// => 1gb -``` - -## Installation - -``` -$ npm install bytes -$ component install visionmedia/bytes.js -``` - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/component.json deleted file mode 100644 index 2929c25d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/component.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "bytes", - "description": "byte size string parser / serializer", - "keywords": ["bytes", "utility"], - "version": "0.2.1", - "scripts": ["index.js"] -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/index.js deleted file mode 100644 index 70b2e01a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/index.js +++ /dev/null @@ -1,39 +0,0 @@ - -/** - * Parse byte `size` string. - * - * @param {String} size - * @return {Number} - * @api public - */ - -module.exports = function(size) { - if ('number' == typeof size) return convert(size); - var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) - , n = parseFloat(parts[1]) - , type = parts[2]; - - var map = { - kb: 1 << 10 - , mb: 1 << 20 - , gb: 1 << 30 - }; - - return map[type] * n; -}; - -/** - * convert bytes into string. - * - * @param {Number} b - bytes to convert - * @return {String} - * @api public - */ - -function convert (b) { - var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10; - if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb'; - if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb'; - if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb'; - return b + 'b'; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/bytes/package.json deleted file mode 100644 index 3eed0ec4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/bytes/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "bytes", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "byte size string parser / serializer", - "version": "0.2.1", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "component": { - "scripts": { - "bytes/index.js": "index.js" - } - }, - "readme": "# node-bytes\n\n Byte string parser / formatter.\n\n## Example:\n\n```js\nbytes('1kb')\n// => 1024\n\nbytes('2mb')\n// => 2097152\n\nbytes('1gb')\n// => 1073741824\n\nbytes(1073741824)\n// => 1gb\n```\n\n## Installation\n\n```\n$ npm install bytes\n$ component install visionmedia/bytes.js\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "bytes@0.2.1", - "dist": { - "shasum": "61bcb30d55a7c8512ac77f38ee20b0fc6ee2c33f" - }, - "_from": "bytes@0.2.1", - "_resolved": "https://registry.npmjs.org/bytes/-/bytes-0.2.1.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.jshintrc b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.jshintrc deleted file mode 100644 index a93b50cf..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.jshintrc +++ /dev/null @@ -1,70 +0,0 @@ -{ - // Settings - "passfail" : false, // Stop on first error. - "maxerr" : 100, // Maximum errors before stopping. - - - // Predefined globals whom JSHint will ignore. - "browser" : false, // Standard browser globals e.g. `window`, `document`. - - "node" : true, - "rhino" : false, - "couch" : false, - "wsh" : false, // Windows Scripting Host. - - "jquery" : false, - "prototypejs" : false, - "mootools" : false, - "dojo" : false, - - - "predef" : [ - "describe", "it", "before", "after" - ], - - // Development. - "debug" : true, // Allow debugger statements e.g. browser breakpoints. - "devel" : true, // Allow development statements e.g. `console.log();`. - - - // EcmaScript 5. - "es5" : true, // Allow EcmaScript 5 syntax. - "strict" : false, // Require `use strict` pragma in every file. - "globalstrict" : true, // Allow global "use strict" (also enables 'strict'). - - - // The Good Parts. - "asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons). - "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. - "laxcomma" : true, - "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.). - "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. - "curly" : false, // Require {} for every new block or scope. - "eqeqeq" : true, // Require triple equals i.e. `===`. - "eqnull" : true, // Tolerate use of `== null`. - "evil" : false, // Tolerate use of `eval`. - "expr" : false, // Tolerate `ExpressionStatement` as Programs. - "forin" : false, // Prohibt `for in` loops without `hasOwnProperty`. - "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` - "latedef" : false, // Prohibit variable use before definition. - "loopfunc" : false, // Allow functions to be defined within loops. - "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. - "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. - "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. - "scripturl" : false, // Tolerate script-targeted URLs. - "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. - "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. - "undef" : true, // Require all non-global variables be declared before they are used. - - - // Persone styling prefrences. - "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. - "noempty" : true, // Prohibit use of empty blocks. - "nonew" : true, // Prohibit use of constructors for side-effects. - "nomen" : false, // Prohibit use of initial or trailing underbars in names. - "onevar" : false, // Allow only one `var` statement per function. - "plusplus" : false, // Prohibit use of `++` & `--`. - "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. - "trailing" : true, // Prohibit trailing whitespaces. - "white" : false // Check against strict whitespace and indentation rules. -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.npmignore deleted file mode 100644 index 07e6e472..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.travis.yml deleted file mode 100644 index b1fc4b01..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" -before_script: - - ulimit -n 500 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/CHANGELOG.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/CHANGELOG.md deleted file mode 100644 index ea54d9a1..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/CHANGELOG.md +++ /dev/null @@ -1,191 +0,0 @@ -### 2.2.0 - - * additional callback API to support multiple files with same field name - * fix assertion crash when max field count is exceeded - * fix assertion crash when client aborts an invalid request - * (>=v0.10 only) unpipe the request when an error occurs to save resources. - * update readable-stream to ~1.1.9 - * fix assertion crash when EMFILE occurrs - * (no more assertions - only 'error' events) - -### 2.1.9 - - * relax content-type detection regex. (thanks amitaibu) - -### 2.1.8 - - * replace deprecated Buffer.write(). (thanks hueniverse) - -### 2.1.7 - - * add repository field to package.json - -### 2.1.6 - - * expose `hash` as an option to `Form`. (thanks wookiehangover) - -### 2.1.5 - - * fix possible 'close' event before all temp files are done - -### 2.1.4 - - * fix crash for invalid requests - -### 2.1.3 - - * add `file.size` - -### 2.1.2 - - * proper backpressure support - * update s3 example - -### 2.1.1 - - * fix uploads larger than 2KB - * fix both s3 and upload example - * add part.byteCount and part.byteOffset - -### 2.1.0 (recalled) - - * Complete rewrite. See README for changes and new API. - -### v1.0.13 - -* Only update hash if update method exists (Sven Lito) -* According to travis v0.10 needs to go quoted (Sven Lito) -* Bumping build node versions (Sven Lito) -* Additional fix for empty requests (Eugene Girshov) -* Change the default to 1000, to match the new Node behaviour. (OrangeDog) -* Add ability to control maxKeys in the querystring parser. (OrangeDog) -* Adjust test case to work with node 0.9.x (Eugene Girshov) -* Update package.json (Sven Lito) -* Path adjustment according to eb4468b (Markus Ast) - -### v1.0.12 - -* Emit error on aborted connections (Eugene Girshov) -* Add support for empty requests (Eugene Girshov) -* Fix name/filename handling in Content-Disposition (jesperp) -* Tolerate malformed closing boundary in multipart (Eugene Girshov) -* Ignore preamble in multipart messages (Eugene Girshov) -* Add support for application/json (Mike Frey, Carlos Rodriguez) -* Add support for Base64 encoding (Elmer Bulthuis) -* Add File#toJSON (TJ Holowaychuk) -* Remove support for Node.js 0.4 & 0.6 (Andrew Kelley) -* Documentation improvements (Sven Lito, Andre Azevedo) -* Add support for application/octet-stream (Ion Lupascu, Chris Scribner) -* Use os.tmpDir() to get tmp directory (Andrew Kelley) -* Improve package.json (Andrew Kelley, Sven Lito) -* Fix benchmark script (Andrew Kelley) -* Fix scope issue in incoming_forms (Sven Lito) -* Fix file handle leak on error (OrangeDog) - -### v1.0.11 - -* Calculate checksums for incoming files (sreuter) -* Add definition parameters to "IncomingForm" as an argument (Math-) - -### v1.0.10 - -* Make parts to be proper Streams (Matt Robenolt) - -### v1.0.9 - -* Emit progress when content length header parsed (Tim Koschützki) -* Fix Readme syntax due to GitHub changes (goob) -* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara) - -### v1.0.8 - -* Strip potentially unsafe characters when using `keepExtensions: true`. -* Switch to utest / urun for testing -* Add travis build - -### v1.0.7 - -* Remove file from package that was causing problems when installing on windows. (#102) -* Fix typos in Readme (Jason Davies). - -### v1.0.6 - -* Do not default to the default to the field name for file uploads where - filename="". - -### v1.0.5 - -* Support filename="" in multipart parts -* Explain unexpected end() errors in parser better - -**Note:** Starting with this version, formidable emits 'file' events for empty -file input fields. Previously those were incorrectly emitted as regular file -input fields with value = "". - -### v1.0.4 - -* Detect a good default tmp directory regardless of platform. (#88) - -### v1.0.3 - -* Fix problems with utf8 characters (#84) / semicolons in filenames (#58) -* Small performance improvements -* New test suite and fixture system - -### v1.0.2 - -* Exclude node\_modules folder from git -* Implement new `'aborted'` event -* Fix files in example folder to work with recent node versions -* Make gently a devDependency - -[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2) - -### v1.0.1 - -* Fix package.json to refer to proper main directory. (#68, Dean Landolt) - -[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1) - -### v1.0.0 - -* Add support for multipart boundaries that are quoted strings. (Jeff Craig) - -This marks the beginning of development on version 2.0 which will include -several architectural improvements. - -[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0) - -### v0.9.11 - -* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki) -* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class - -**Important:** The old property names of the File class will be removed in a -future release. - -[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11) - -### Older releases - -These releases were done before starting to maintain the above Changelog: - -* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10) -* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9) -* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8) -* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7) -* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6) -* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5) -* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4) -* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3) -* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2) -* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/LICENSE deleted file mode 100644 index 8488a405..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (C) 2011-2013 Felix Geisendörfer, Andrew Kelley - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/README.md deleted file mode 100644 index f149ac04..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/README.md +++ /dev/null @@ -1,177 +0,0 @@ -[![Build Status](https://travis-ci.org/superjoe30/node-multiparty.png?branch=master)](https://travis-ci.org/superjoe30/node-multiparty) -# multiparty - -Parse http requests with content-type `multipart/form-data`, also known as file uploads. - -See also [busboy](https://github.com/mscdex/busboy) - a -[faster](https://github.com/mscdex/dicer/wiki/Benchmarks) alternative -which may be worth looking into. - -### Why the fork? - - * This module uses the Node.js v0.10 streams properly, *even in Node.js v0.8* - * It will not create a temp file for you unless you want it to. - * Counts bytes and does math to help you figure out the `Content-Length` of - each part. - * You can easily stream uploads to s3 with - [knox](https://github.com/LearnBoost/knox), for [example](examples/s3.js). - * Less bugs. This code is simpler, has all deprecated functionality removed, - has cleaner tests, and does not try to do anything beyond multipart stream - parsing. - -## Installation - -``` -npm install multiparty -``` - -## Usage - - * See [examples](examples). - -Parse an incoming `multipart/form-data` request. - -```js -var multiparty = require('multiparty') - , http = require('http') - , util = require('util') - -http.createServer(function(req, res) { - if (req.url === '/upload' && req.method === 'POST') { - // parse a file upload - var form = new multiparty.Form(); - - 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( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); -}).listen(8080); -``` - -## API - -### multiparty.Form -```js -var form = new multiparty.Form(options) -``` -Creates a new form. Options: - - * `encoding` - sets encoding for the incoming form fields. Defaults to `utf8`. - * `maxFieldSize` - Limits the amount of memory a field (not a file) can - allocate in bytes. If this value is exceeded, an `error` event is emitted. - The default size is 2MB. - * `maxFields` - Limits the number of fields that will be parsed before - emitting an `error` event. A file counts as a field in this case. - Defaults to 1000. - * `autoFields` - Enables `field` events. This is automatically set to `true` - if you add a `field` listener. - * `autoFiles` - Enables `file` events. This is automatically set to `true` - if you add a `file` listener. - * `uploadDir` - Only relevant when `autoFiles` is `true`. The directory for - placing file uploads in. You can move them later using `fs.rename()`. - Defaults to `os.tmpDir()`. - * `hash` - Only relevant when `autoFiles` is `true`. If you want checksums - calculated for incoming files, set this to either `sha1` or `md5`. - Defaults to off. - -#### form.parse(request, [cb]) - -Parses an incoming node.js `request` containing form data. If `cb` is -provided, `autoFields` and `autoFiles` are set to `true` and all fields and -files are collected and passed to the callback: - -```js -form.parse(req, function(err, fieldsObject, filesObject, fieldsList, filesList) { - // ... -}); -``` - -It is often convenient to access a field or file by name. In this situation, -use `fieldsObject` or `filesObject`. However sometimes, as in the case of a -`` the multipart stream will contain -multiple files of the same input name, and you are interested in all of them. -In this case, use `filesList`. - -Another example is when you do not care what the field name of a file is; you -are merely interested in a single upload. In this case, set `maxFields` to 1 -(assuming no other fields expected besides the file) and use `filesList[0]`. - -#### form.bytesReceived - -The amount of bytes received for this form so far. - -#### form.bytesExpected - -The expected number of bytes in this form. - -### Events - -#### 'error' (err) - -You definitely want to handle this event. If not your server *will* crash when -users submit bogus multipart requests! - -#### 'part' (part) - -Emitted when a part is encountered in the request. `part` is a -`ReadableStream`. It also has the following properties: - - * `headers` - the headers for this part. For example, you may be interested - in `content-type`. - * `name` - the field name for this part - * `filename` - only if the part is an incoming file - * `byteOffset` - the byte offset of this part in the request body - * `byteCount` - assuming that this is the last part in the request, - this is the size of this part in bytes. You could use this, for - example, to set the `Content-Length` header if uploading to S3. - If the part had a `Content-Length` header then that value is used - here instead. - -#### 'aborted' - -Emitted when the request is aborted. This event will be followed shortly -by an `error` event. In practice you do not need to handle this event. - -#### 'progress' (bytesReceived, bytesExpected) - -#### 'close' - -Emitted after all parts have been parsed and emitted. Not emitted if an `error` -event is emitted. This is typically when you would send your response. - -#### 'file' (name, file) - -**By default multiparty will not touch your hard drive.** But if you add this -listener, multiparty automatically sets `form.autoFiles` to `true` and will -stream uploads to disk for you. - - * `name` - the field name for this file - * `file` - an object with these properties: - - `fieldName` - same as `name` - the field name for this file - - `originalFilename` - the filename that the user reports for the file - - `path` - the absolute path of the uploaded file on disk - - `headers` - the HTTP headers that were sent along with this file - - `size` - size of the file in bytes - -If you set the `form.hash` option, then `file` will also contain a `hash` -property which is the checksum of the file. - -#### 'field' (name, value) - - * `name` - field name - * `value` - string field value - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/azureblobstorage.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/azureblobstorage.js deleted file mode 100644 index 273c3321..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/azureblobstorage.js +++ /dev/null @@ -1,41 +0,0 @@ -var http = require('http') - , util = require('util') - , multiparty = require('../') - , azure = require('azure') - , PORT = process.env.PORT || 27372 - -var server = http.createServer(function(req, res) { - if (req.url === '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url === '/upload') { - - var blobService = azure.createBlobService(); - var form = new multiparty.Form(); - form.on('part', function(part) { - if (!part.filename) return; - - var size = part.byteCount - part.byteOffset; - var name = part.filename; - var container = 'blobContainerName'; - - blobService.createBlockBlobFromStream(container, name, part, size, function(error) { - if (error) { - // error handling - } - }); - }); - form.parse(req); - - res.send('File uploaded successfully'); - } -}); -server.listen(PORT, function() { - console.info('listening on http://0.0.0.0:'+PORT+'/'); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/s3.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/s3.js deleted file mode 100644 index 60617ba2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/s3.js +++ /dev/null @@ -1,74 +0,0 @@ -var http = require('http') - , util = require('util') - , multiparty = require('../') - , knox = require('knox') - , Batch = require('batch') - , PORT = process.env.PORT || 27372 - -var s3Client = knox.createClient({ - secure: false, - key: process.env.S3_KEY, - secret: process.env.S3_SECRET, - bucket: process.env.S3_BUCKET, -}); - -var server = http.createServer(function(req, res) { - if (req.url === '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url === '/upload') { - var headers = { - 'x-amz-acl': 'public-read', - }; - var form = new multiparty.Form(); - var batch = new Batch(); - batch.push(function(cb) { - form.on('field', function(name, value) { - if (name === 'path') { - var destPath = value; - if (destPath[0] !== '/') destPath = '/' + destPath; - cb(null, destPath); - } - }); - }); - batch.push(function(cb) { - form.on('part', function(part) { - if (! part.filename) return; - cb(null, part); - }); - }); - batch.end(function(err, results) { - if (err) throw err; - form.removeListener('close', onEnd); - var destPath = results[0] - , part = results[1]; - - headers['Content-Length'] = part.byteCount; - s3Client.putStream(part, destPath, headers, function(err, s3Response) { - if (err) throw err; - res.statusCode = s3Response.statusCode; - s3Response.pipe(res); - console.log("https://s3.amazonaws.com/" + process.env.S3_BUCKET + destPath); - }); - }); - form.on('close', onEnd); - form.parse(req); - - } else { - res.writeHead(404, {'content-type': 'text/plain'}); - res.end('404'); - } - - function onEnd() { - throw new Error("no uploaded file"); - } -}); -server.listen(PORT, function() { - console.info('listening on http://0.0.0.0:'+PORT+'/'); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/upload.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/upload.js deleted file mode 100644 index 5dd39268..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/examples/upload.js +++ /dev/null @@ -1,37 +0,0 @@ -var http = require('http') - , util = require('util') - , multiparty = require('../') - , PORT = process.env.PORT || 27372 - -var server = http.createServer(function(req, res) { - if (req.url === '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url === '/upload') { - var form = new multiparty.Form(); - - form.parse(req, function(err, fields, files) { - if (err) { - res.writeHead(400, {'content-type': 'text/plain'}); - res.end("invalid request: " + err.message); - return; - } - 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)); - }); - } else { - res.writeHead(404, {'content-type': 'text/plain'}); - res.end('404'); - } -}); -server.listen(PORT, function() { - console.info('listening on http://0.0.0.0:'+PORT+'/'); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/index.js deleted file mode 100644 index 71c88ae3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/index.js +++ /dev/null @@ -1,618 +0,0 @@ -exports.Form = Form; - -var stream = require('readable-stream') - , util = require('util') - , fs = require('fs') - , crypto = require('crypto') - , path = require('path') - , os = require('os') - , StringDecoder = require('string_decoder').StringDecoder - , StreamCounter = require('stream-counter') - -var START = 0 - , START_BOUNDARY = 1 - , HEADER_FIELD_START = 2 - , HEADER_FIELD = 3 - , HEADER_VALUE_START = 4 - , HEADER_VALUE = 5 - , HEADER_VALUE_ALMOST_DONE = 6 - , HEADERS_ALMOST_DONE = 7 - , PART_DATA_START = 8 - , PART_DATA = 9 - , PART_END = 10 - , END = 11 - - , LF = 10 - , CR = 13 - , SPACE = 32 - , HYPHEN = 45 - , COLON = 58 - , A = 97 - , Z = 122 - -var CONTENT_TYPE_RE = /^multipart\/(form-data|related);\s*boundary=(?:"([^"]+)"|([^;]+))$/i; -var FILE_EXT_RE = /(\.[_\-a-zA-Z0-9]{0,16}).*/; -var LAST_BOUNDARY_SUFFIX_LEN = 4; // --\r\n - -util.inherits(Form, stream.Writable); -function Form(options) { - var self = this; - stream.Writable.call(self); - - options = options || {}; - - self.error = null; - self.finished = false; - - self.autoFields = !!options.autoFields; - self.autoFiles = !!options.autoFields; - - self.maxFields = options.maxFields || 1000; - self.maxFieldsSize = options.maxFieldsSize || 2 * 1024 * 1024; - self.uploadDir = options.uploadDir || os.tmpDir(); - self.encoding = options.encoding || 'utf8'; - self.hash = options.hash || false; - - self.bytesReceived = 0; - self.bytesExpected = null; - - self.openedFiles = []; - self.totalFieldSize = 0; - self.totalFieldCount = 0; - self.flushing = 0; - - self.backpressure = false; - self.writeCbs = []; - - if (options.boundary) setUpParser(self, options.boundary); - - self.on('newListener', function(eventName) { - if (eventName === 'file') { - self.autoFiles = true; - } else if (eventName === 'field') { - self.autoFields = true; - } - }); -} - -Form.prototype.parse = function(req, cb) { - var self = this; - - // if the user supplies a callback, this implies autoFields and autoFiles - if (cb) { - self.autoFields = true; - self.autoFiles = true; - } - - self.handleError = handleError; - self.bytesExpected = getBytesExpected(req.headers); - - req.on('error', handleError); - req.on('aborted', onReqAborted); - - var contentType = req.headers['content-type']; - if (!contentType) { - handleError(new Error('missing content-type header')); - return; - } - - var m = contentType.match(CONTENT_TYPE_RE); - if (!m) { - handleError(new Error('unrecognized content-type: ' + contentType)); - return; - } - var boundary = m[2] || m[3]; - setUpParser(self, boundary); - req.pipe(self); - - if (cb) { - var fieldsTable = {}; - var filesTable = {}; - var fieldsList = []; - var filesList = []; - self.on('error', function(err) { - cb(err); - }); - self.on('field', function(name, value) { - fieldsTable[name] = value; - fieldsList.push({name: name, value: value}); - }); - self.on('file', function(name, file) { - filesTable[name] = file; - filesList.push(file); - }); - self.on('close', function() { - cb(null, fieldsTable, filesTable, fieldsList, filesList); - }); - } - - function onReqAborted() { - self.emit('aborted'); - handleError(new Error("Request aborted")); - } - - function handleError(err) { - var first = !self.error; - if (first) { - self.error = err; - req.removeListener('aborted', onReqAborted); - - // welp. 0.8 doesn't support unpipe, too bad so sad. - // let's drop support for 0.8 soon. - if (req.unpipe) { - req.unpipe(self); - } - } - - self.openedFiles.forEach(function(file) { - file.ws.destroy(); - fs.unlink(file.path, function(err) { - // this is already an error condition, ignore 2nd error - }); - }); - self.openedFiles = []; - - if (first) { - self.emit('error', err); - } - } - -}; - -Form.prototype._write = function(buffer, encoding, cb) { - var self = this - , i = 0 - , len = buffer.length - , prevIndex = self.index - , index = self.index - , state = self.state - , lookbehind = self.lookbehind - , boundary = self.boundary - , boundaryChars = self.boundaryChars - , boundaryLength = self.boundary.length - , boundaryEnd = boundaryLength - 1 - , bufferLength = buffer.length - , c - , cl - - for (i = 0; i < len; i++) { - c = buffer[i]; - switch (state) { - case START: - index = 0; - state = START_BOUNDARY; - /* falls through */ - case START_BOUNDARY: - if (index === boundaryLength - 2) { - if (c !== CR) return self.handleError(new Error("Expected CR Received " + c)); - index++; - break; - } else if (index === boundaryLength - 1) { - if (c !== LF) return self.handleError(new Error("Expected LF Received " + c)); - index = 0; - self.onParsePartBegin(); - state = HEADER_FIELD_START; - break; - } - - if (c !== boundary[index+2]) index = -2; - if (c === boundary[index+2]) index++; - break; - case HEADER_FIELD_START: - state = HEADER_FIELD; - self.headerFieldMark = i; - index = 0; - /* falls through */ - case HEADER_FIELD: - if (c === CR) { - self.headerFieldMark = null; - state = HEADERS_ALMOST_DONE; - break; - } - - index++; - if (c === HYPHEN) break; - - if (c === COLON) { - if (index === 1) { - // empty header field - self.handleError(new Error("Empty header field")); - return; - } - self.onParseHeaderField(buffer.slice(self.headerFieldMark, i)); - self.headerFieldMark = null; - state = HEADER_VALUE_START; - break; - } - - cl = lower(c); - if (cl < A || cl > Z) { - self.handleError(new Error("Expected alphabetic character, received " + c)); - return; - } - break; - case HEADER_VALUE_START: - if (c === SPACE) break; - - self.headerValueMark = i; - state = HEADER_VALUE; - /* falls through */ - case HEADER_VALUE: - if (c === CR) { - self.onParseHeaderValue(buffer.slice(self.headerValueMark, i)); - self.headerValueMark = null; - self.onParseHeaderEnd(); - state = HEADER_VALUE_ALMOST_DONE; - } - break; - case HEADER_VALUE_ALMOST_DONE: - if (c !== LF) return self.handleError(new Error("Expected LF Received " + c)); - state = HEADER_FIELD_START; - break; - case HEADERS_ALMOST_DONE: - if (c !== LF) return self.handleError(new Error("Expected LF Received " + c)); - var err = self.onParseHeadersEnd(i + 1); - if (err) return self.handleError(err); - state = PART_DATA_START; - break; - case PART_DATA_START: - state = PART_DATA; - self.partDataMark = i; - /* falls through */ - case 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 < boundaryLength) { - if (boundary[index] === c) { - if (index === 0) { - self.onParsePartData(buffer.slice(self.partDataMark, i)); - self.partDataMark = null; - } - index++; - } else { - index = 0; - } - } else if (index === boundaryLength) { - index++; - if (c === CR) { - // CR = part boundary - self.partBoundaryFlag = true; - } else if (c === HYPHEN) { - // HYPHEN = end boundary - self.lastBoundaryFlag = true; - } else { - index = 0; - } - } else if (index - 1 === boundaryLength) { - if (self.partBoundaryFlag) { - index = 0; - if (c === LF) { - self.partBoundaryFlag = false; - self.onParsePartEnd(); - self.onParsePartBegin(); - state = HEADER_FIELD_START; - break; - } - } else if (self.lastBoundaryFlag) { - if (c === HYPHEN) { - self.onParsePartEnd(); - self.end(); - state = 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 - self.onParsePartData(lookbehind.slice(0, prevIndex)); - prevIndex = 0; - self.partDataMark = i; - - // reconsider the current character even so it interrupted the sequence - // it could be the beginning of a new sequence - i--; - } - - break; - case END: - break; - default: - self.handleError(new Error("Parser has invalid state.")); - return; - } - } - - if (self.headerFieldMark != null) { - self.onParseHeaderField(buffer.slice(self.headerFieldMark)); - self.headerFieldMark = 0; - } - if (self.headerValueMark != null) { - self.onParseHeaderValue(buffer.slice(self.headerValueMark)); - self.headerValueMark = 0; - } - if (self.partDataMark != null) { - self.onParsePartData(buffer.slice(self.partDataMark)); - self.partDataMark = 0; - } - - self.index = index; - self.state = state; - - self.bytesReceived += buffer.length; - self.emit('progress', self.bytesReceived, self.bytesExpected); - - if (self.backpressure) { - self.writeCbs.push(cb); - } else { - cb(); - } -}; - -Form.prototype.onParsePartBegin = function() { - clearPartVars(this); -} - -Form.prototype.onParseHeaderField = function(b) { - this.headerField += this.headerFieldDecoder.write(b); -} - -Form.prototype.onParseHeaderValue = function(b) { - this.headerValue += this.headerValueDecoder.write(b); -} - -Form.prototype.onParseHeaderEnd = function() { - this.headerField = this.headerField.toLowerCase(); - this.partHeaders[this.headerField] = this.headerValue; - - var m; - if (this.headerField === 'content-disposition') { - if (m = this.headerValue.match(/\bname="([^"]+)"/i)) { - this.partName = m[1]; - } - this.partFilename = parseFilename(this.headerValue); - } else if (this.headerField === 'content-transfer-encoding') { - this.partTransferEncoding = this.headerValue.toLowerCase(); - } - - this.headerFieldDecoder = new StringDecoder(this.encoding); - this.headerField = ''; - this.headerValueDecoder = new StringDecoder(this.encoding); - this.headerValue = ''; -} - -Form.prototype.onParsePartData = function(b) { - if (this.partTransferEncoding === 'base64') { - this.backpressure = ! this.destStream.write(b.toString('ascii'), 'base64'); - } else { - this.backpressure = ! this.destStream.write(b); - } -} - -Form.prototype.onParsePartEnd = function() { - if (this.destStream) { - flushWriteCbs(this); - var s = this.destStream; - process.nextTick(function() { - s.end(); - }); - } - clearPartVars(this); -} - -Form.prototype.onParseHeadersEnd = function(offset) { - var self = this; - switch(self.partTransferEncoding){ - case 'binary': - case '7bit': - case '8bit': - self.partTransferEncoding = 'binary'; - break; - - case 'base64': break; - default: - return new Error("unknown transfer-encoding: " + self.partTransferEncoding); - } - - self.totalFieldCount += 1; - if (self.totalFieldCount >= self.maxFields) { - return new Error("maxFields " + self.maxFields + " exceeded."); - } - - self.destStream = new stream.PassThrough(); - self.destStream.on('drain', function() { - flushWriteCbs(self); - }); - self.destStream.headers = self.partHeaders; - self.destStream.name = self.partName; - self.destStream.filename = self.partFilename; - self.destStream.byteOffset = self.bytesReceived + offset; - var partContentLength = self.destStream.headers['content-length']; - self.destStream.byteCount = partContentLength ? - parseInt(partContentLength, 10) : - (self.bytesExpected - self.destStream.byteOffset - - self.boundary.length - LAST_BOUNDARY_SUFFIX_LEN); - - self.emit('part', self.destStream); - if (self.destStream.filename == null && self.autoFields) { - handleField(self, self.destStream); - } else if (self.destStream.filename != null && self.autoFiles) { - handleFile(self, self.destStream); - } -} - -function flushWriteCbs(self) { - self.writeCbs.forEach(function(cb) { - process.nextTick(cb); - }); - self.writeCbs = []; - self.backpressure = false; -} - -function getBytesExpected(headers) { - var contentLength = headers['content-length']; - if (contentLength) { - return parseInt(contentLength, 10); - } else if (headers['transfer-encoding'] == null) { - return 0; - } else { - return null; - } -} - -function beginFlush(self) { - self.flushing += 1; -} - -function endFlush(self) { - self.flushing -= 1; - maybeClose(self); -} - -function maybeClose(self) { - if (!self.flushing && self.finished && !self.error) { - self.emit('close'); - } -} - -function handleFile(self, fileStream) { - beginFlush(self); - var file = { - fieldName: fileStream.name, - originalFilename: fileStream.filename, - path: uploadPath(self.uploadDir, fileStream.filename), - headers: fileStream.headers, - }; - file.ws = fs.createWriteStream(file.path); - self.openedFiles.push(file); - fileStream.pipe(file.ws); - var counter = new StreamCounter(); - fileStream.pipe(counter); - var hashWorkaroundStream - , hash = null; - if (self.hash) { - // workaround stream because https://github.com/joyent/node/issues/5216 - hashWorkaroundStream = stream.Writable(); - hash = crypto.createHash(self.hash); - hashWorkaroundStream._write = function(buffer, encoding, callback) { - hash.update(buffer); - callback(); - }; - fileStream.pipe(hashWorkaroundStream); - } - file.ws.on('error', function(err) { - if (!self.error) self.handleError(err); - }); - file.ws.on('close', function() { - if (hash) file.hash = hash.digest('hex'); - file.size = counter.bytes; - self.emit('file', fileStream.name, file); - endFlush(self); - }); -} - -function handleField(self, fieldStream) { - var value = ''; - var decoder = new StringDecoder(self.encoding); - - beginFlush(self); - fieldStream.on('readable', function() { - var buffer = fieldStream.read(); - if (!buffer) return; - - self.totalFieldSize += buffer.length; - if (self.totalFieldSize > self.maxFieldsSize) { - self.handleError(new Error("maxFieldsSize " + self.maxFieldsSize + " exceeded")); - return; - } - value += decoder.write(buffer); - }); - - fieldStream.on('end', function() { - self.emit('field', fieldStream.name, value); - endFlush(self); - }); -} - -function clearPartVars(self) { - self.partHeaders = {}; - self.partName = null; - self.partFilename = null; - self.partTransferEncoding = 'binary'; - self.destStream = null; - - self.headerFieldDecoder = new StringDecoder(self.encoding); - self.headerField = ""; - self.headerValueDecoder = new StringDecoder(self.encoding); - self.headerValue = ""; -} - -function setUpParser(self, boundary) { - self.boundary = new Buffer(boundary.length + 4); - self.boundary.write('\r\n--', 0, boundary.length + 4, 'ascii'); - self.boundary.write(boundary, 4, boundary.length, 'ascii'); - self.lookbehind = new Buffer(self.boundary.length + 8); - self.state = START; - self.boundaryChars = {}; - for (var i = 0; i < self.boundary.length; i++) { - self.boundaryChars[self.boundary[i]] = true; - } - - self.index = null; - self.partBoundaryFlag = false; - self.lastBoundaryFlag = false; - - self.on('finish', function() { - if ((self.state === HEADER_FIELD_START && self.index === 0) || - (self.state === PART_DATA && self.index === self.boundary.length)) - { - self.onParsePartEnd(); - } else if (self.state !== END) { - self.handleError(new Error('stream ended unexpectedly')); - } - self.finished = true; - maybeClose(self); - }); -} - -function uploadPath(baseDir, filename) { - var ext = path.extname(filename).replace(FILE_EXT_RE, '$1'); - var name = process.pid + '-' + - (Math.random() * 0x100000000 + 1).toString(36) + ext; - return path.join(baseDir, name); -} - -function parseFilename(headerValue) { - var m = headerValue.match(/\bfilename="(.*?)"($|; )/i); - if (!m) return; - - var filename = m[1].substr(m[1].lastIndexOf('\\') + 1); - filename = filename.replace(/%22/g, '"'); - filename = filename.replace(/&#([\d]{4});/g, function(m, code) { - return String.fromCharCode(code); - }); - return filename; -} - -function lower(c) { - return c | 0x20; -} - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/.npmignore deleted file mode 100644 index 38344f87..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -build/ -test/ -examples/ -fs.js -zlib.js \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/LICENSE deleted file mode 100644 index e3d4e695..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/README.md deleted file mode 100644 index be976683..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/README.md +++ /dev/null @@ -1,768 +0,0 @@ -# readable-stream - -A new class of streams for Node.js - -This module provides the new Stream base classes introduced in Node -v0.10, for use in Node v0.8. You can use it to have programs that -have to work with node v0.8, while being forward-compatible for v0.10 -and beyond. When you drop support for v0.8, you can remove this -module, and only use the native streams. - -This is almost exactly the same codebase as appears in Node v0.10. -However: - -1. The exported object is actually the Readable class. Decorating the - native `stream` module would be global pollution. -2. In v0.10, you can safely use `base64` as an argument to - `setEncoding` in Readable streams. However, in v0.8, the - StringDecoder class has no `end()` method, which is problematic for - Base64. So, don't use that, because it'll break and be weird. - -Other than that, the API is the same as `require('stream')` in v0.10, -so the API docs are reproduced below. - ----------- - - Stability: 2 - Unstable - -A stream is an abstract interface implemented by various objects in -Node. For example a request to an HTTP server is a stream, as is -stdout. Streams are readable, writable, or both. All streams are -instances of [EventEmitter][] - -You can load the Stream base classes by doing `require('stream')`. -There are base classes provided for Readable streams, Writable -streams, Duplex streams, and Transform streams. - -## Compatibility - -In earlier versions of Node, the Readable stream interface was -simpler, but also less powerful and less useful. - -* Rather than waiting for you to call the `read()` method, `'data'` - events would start emitting immediately. If you needed to do some - I/O to decide how to handle data, then you had to store the chunks - in some kind of buffer so that they would not be lost. -* The `pause()` method was advisory, rather than guaranteed. This - meant that you still had to be prepared to receive `'data'` events - even when the stream was in a paused state. - -In Node v0.10, the Readable class described below was added. For -backwards compatibility with older Node programs, Readable streams -switch into "old mode" when a `'data'` event handler is added, or when -the `pause()` or `resume()` methods are called. The effect is that, -even if you are not using the new `read()` method and `'readable'` -event, you no longer have to worry about losing `'data'` chunks. - -Most programs will continue to function normally. However, this -introduces an edge case in the following conditions: - -* No `'data'` event handler is added. -* The `pause()` and `resume()` methods are never called. - -For example, consider the following code: - -```javascript -// WARNING! BROKEN! -net.createServer(function(socket) { - - // we add an 'end' method, but never consume the data - socket.on('end', function() { - // It will never get here. - socket.end('I got your message (but didnt read it)\n'); - }); - -}).listen(1337); -``` - -In versions of node prior to v0.10, the incoming message data would be -simply discarded. However, in Node v0.10 and beyond, the socket will -remain paused forever. - -The workaround in this situation is to call the `resume()` method to -trigger "old mode" behavior: - -```javascript -// Workaround -net.createServer(function(socket) { - - socket.on('end', function() { - socket.end('I got your message (but didnt read it)\n'); - }); - - // start the flow of data, discarding it. - socket.resume(); - -}).listen(1337); -``` - -In addition to new Readable streams switching into old-mode, pre-v0.10 -style streams can be wrapped in a Readable class using the `wrap()` -method. - -## Class: stream.Readable - - - -A `Readable Stream` has the following methods, members, and events. - -Note that `stream.Readable` is an abstract class designed to be -extended with an underlying implementation of the `_read(size)` -method. (See below.) - -### new stream.Readable([options]) - -* `options` {Object} - * `highWaterMark` {Number} The maximum number of bytes to store in - the internal buffer before ceasing to read from the underlying - resource. Default=16kb - * `encoding` {String} If specified, then buffers will be decoded to - strings using the specified encoding. Default=null - * `objectMode` {Boolean} Whether this stream should behave - as a stream of objects. Meaning that stream.read(n) returns - a single value instead of a Buffer of size n - -In classes that extend the Readable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### readable.\_read(size) - -* `size` {Number} Number of bytes to read asynchronously - -Note: **This function should NOT be called directly.** It should be -implemented by child classes, and called by the internal Readable -class methods only. - -All Readable stream implementations must provide a `_read` method -to fetch data from the underlying resource. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -When data is available, put it into the read queue by calling -`readable.push(chunk)`. If `push` returns false, then you should stop -reading. When `_read` is called again, you should start pushing more -data. - -The `size` argument is advisory. Implementations where a "read" is a -single call that returns data can use this to know how much data to -fetch. Implementations where that is not relevant, such as TCP or -TLS, may ignore this argument, and simply provide data whenever it -becomes available. There is no need, for example to "wait" until -`size` bytes are available before calling `stream.push(chunk)`. - -### readable.push(chunk) - -* `chunk` {Buffer | null | String} Chunk of data to push into the read queue -* return {Boolean} Whether or not more pushes should be performed - -Note: **This function should be called by Readable implementors, NOT -by consumers of Readable subclasses.** The `_read()` function will not -be called again until at least one `push(chunk)` call is made. If no -data is available, then you MAY call `push('')` (an empty string) to -allow a future `_read` call, without adding any data to the queue. - -The `Readable` class works by putting data into a read queue to be -pulled out later by calling the `read()` method when the `'readable'` -event fires. - -The `push()` method will explicitly insert some data into the read -queue. If it is called with `null` then it will signal the end of the -data. - -In some cases, you may be wrapping a lower-level source which has some -sort of pause/resume mechanism, and a data callback. In those cases, -you could wrap the low-level source object by doing something like -this: - -```javascript -// source is an object with readStop() and readStart() methods, -// and an `ondata` member that gets called when it has data, and -// an `onend` member that gets called when the data is over. - -var stream = new Readable(); - -source.ondata = function(chunk) { - // if push() returns false, then we need to stop reading from source - if (!stream.push(chunk)) - source.readStop(); -}; - -source.onend = function() { - stream.push(null); -}; - -// _read will be called when the stream wants to pull more data in -// the advisory size argument is ignored in this case. -stream._read = function(n) { - source.readStart(); -}; -``` - -### readable.unshift(chunk) - -* `chunk` {Buffer | null | String} Chunk of data to unshift onto the read queue -* return {Boolean} Whether or not more pushes should be performed - -This is the corollary of `readable.push(chunk)`. Rather than putting -the data at the *end* of the read queue, it puts it at the *front* of -the read queue. - -This is useful in certain use-cases where a stream is being consumed -by a parser, which needs to "un-consume" some data that it has -optimistically pulled out of the source. - -```javascript -// A parser for a simple data protocol. -// The "header" is a JSON object, followed by 2 \n characters, and -// then a message body. -// -// Note: This can be done more simply as a Transform stream. See below. - -function SimpleProtocol(source, options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Readable.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - - // source is a readable stream, such as a socket or file - this._source = source; - - var self = this; - source.on('end', function() { - self.push(null); - }); - - // give it a kick whenever the source is readable - // read(0) will not consume any bytes - source.on('readable', function() { - self.read(0); - }); - - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype = Object.create( - Readable.prototype, { constructor: { value: SimpleProtocol }}); - -SimpleProtocol.prototype._read = function(n) { - if (!this._inBody) { - var chunk = this._source.read(); - - // if the source doesn't have data, we don't have data yet. - if (chunk === null) - return this.push(''); - - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - this.push(''); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // now, because we got some extra data, unshift the rest - // back into the read queue so that our consumer will see it. - var b = chunk.slice(split); - this.unshift(b); - - // and let them know that we are done parsing the header. - this.emit('header', this.header); - } - } else { - // from there on, just provide the data to our consumer. - // careful not to push(null), since that would indicate EOF. - var chunk = this._source.read(); - if (chunk) this.push(chunk); - } -}; - -// Usage: -var parser = new SimpleProtocol(source); -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### readable.wrap(stream) - -* `stream` {Stream} An "old style" readable stream - -If you are using an older Node library that emits `'data'` events and -has a `pause()` method that is advisory only, then you can use the -`wrap()` method to create a Readable stream that uses the old stream -as its data source. - -For example: - -```javascript -var OldReader = require('./old-api-module.js').OldReader; -var oreader = new OldReader; -var Readable = require('stream').Readable; -var myReader = new Readable().wrap(oreader); - -myReader.on('readable', function() { - myReader.read(); // etc. -}); -``` - -### Event: 'readable' - -When there is data ready to be consumed, this event will fire. - -When this event emits, call the `read()` method to consume the data. - -### Event: 'end' - -Emitted when the stream has received an EOF (FIN in TCP terminology). -Indicates that no more `'data'` events will happen. If the stream is -also writable, it may be possible to continue writing. - -### Event: 'data' - -The `'data'` event emits either a `Buffer` (by default) or a string if -`setEncoding()` was used. - -Note that adding a `'data'` event listener will switch the Readable -stream into "old mode", where data is emitted as soon as it is -available, rather than waiting for you to call `read()` to consume it. - -### Event: 'error' - -Emitted if there was an error receiving data. - -### Event: 'close' - -Emitted when the underlying resource (for example, the backing file -descriptor) has been closed. Not all streams will emit this. - -### readable.setEncoding(encoding) - -Makes the `'data'` event emit a string instead of a `Buffer`. `encoding` -can be `'utf8'`, `'utf16le'` (`'ucs2'`), `'ascii'`, or `'hex'`. - -The encoding can also be set by specifying an `encoding` field to the -constructor. - -### readable.read([size]) - -* `size` {Number | null} Optional number of bytes to read. -* Return: {Buffer | String | null} - -Note: **This function SHOULD be called by Readable stream users.** - -Call this method to consume data once the `'readable'` event is -emitted. - -The `size` argument will set a minimum number of bytes that you are -interested in. If not set, then the entire content of the internal -buffer is returned. - -If there is no data to consume, or if there are fewer bytes in the -internal buffer than the `size` argument, then `null` is returned, and -a future `'readable'` event will be emitted when more is available. - -Calling `stream.read(0)` will always return `null`, and will trigger a -refresh of the internal buffer, but otherwise be a no-op. - -### readable.pipe(destination, [options]) - -* `destination` {Writable Stream} -* `options` {Object} Optional - * `end` {Boolean} Default=true - -Connects this readable stream to `destination` WriteStream. Incoming -data on this stream gets written to `destination`. Properly manages -back-pressure so that a slow destination will not be overwhelmed by a -fast readable stream. - -This function returns the `destination` stream. - -For example, emulating the Unix `cat` command: - - process.stdin.pipe(process.stdout); - -By default `end()` is called on the destination when the source stream -emits `end`, so that `destination` is no longer writable. Pass `{ end: -false }` as `options` to keep the destination stream open. - -This keeps `writer` open so that "Goodbye" can be written at the -end. - - reader.pipe(writer, { end: false }); - reader.on("end", function() { - writer.end("Goodbye\n"); - }); - -Note that `process.stderr` and `process.stdout` are never closed until -the process exits, regardless of the specified options. - -### readable.unpipe([destination]) - -* `destination` {Writable Stream} Optional - -Undo a previously established `pipe()`. If no destination is -provided, then all previously established pipes are removed. - -### readable.pause() - -Switches the readable stream into "old mode", where data is emitted -using a `'data'` event rather than being buffered for consumption via -the `read()` method. - -Ceases the flow of data. No `'data'` events are emitted while the -stream is in a paused state. - -### readable.resume() - -Switches the readable stream into "old mode", where data is emitted -using a `'data'` event rather than being buffered for consumption via -the `read()` method. - -Resumes the incoming `'data'` events after a `pause()`. - - -## Class: stream.Writable - - - -A `Writable` Stream has the following methods, members, and events. - -Note that `stream.Writable` is an abstract class designed to be -extended with an underlying implementation of the -`_write(chunk, encoding, cb)` method. (See below.) - -### new stream.Writable([options]) - -* `options` {Object} - * `highWaterMark` {Number} Buffer level when `write()` starts - returning false. Default=16kb - * `decodeStrings` {Boolean} Whether or not to decode strings into - Buffers before passing them to `_write()`. Default=true - -In classes that extend the Writable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### writable.\_write(chunk, encoding, callback) - -* `chunk` {Buffer | String} The chunk to be written. Will always - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. Ignore chunk is a buffer. Note that chunk will - **always** be a buffer unless the `decodeStrings` option is - explicitly set to `false`. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -All Writable stream implementations must provide a `_write` method to -send data to the underlying resource. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Writable -class methods only. - -Call the callback using the standard `callback(error)` pattern to -signal that the write completed successfully or with an error. - -If the `decodeStrings` flag is set in the constructor options, then -`chunk` may be a string rather than a Buffer, and `encoding` will -indicate the sort of string that it is. This is to support -implementations that have an optimized handling for certain string -data encodings. If you do not explicitly set the `decodeStrings` -option to `false`, then you can safely ignore the `encoding` argument, -and assume that `chunk` will always be a Buffer. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - - -### writable.write(chunk, [encoding], [callback]) - -* `chunk` {Buffer | String} Data to be written -* `encoding` {String} Optional. If `chunk` is a string, then encoding - defaults to `'utf8'` -* `callback` {Function} Optional. Called when this chunk is - successfully written. -* Returns {Boolean} - -Writes `chunk` to the stream. Returns `true` if the data has been -flushed to the underlying resource. Returns `false` to indicate that -the buffer is full, and the data will be sent out in the future. The -`'drain'` event will indicate when the buffer is empty again. - -The specifics of when `write()` will return false, is determined by -the `highWaterMark` option provided to the constructor. - -### writable.end([chunk], [encoding], [callback]) - -* `chunk` {Buffer | String} Optional final data to be written -* `encoding` {String} Optional. If `chunk` is a string, then encoding - defaults to `'utf8'` -* `callback` {Function} Optional. Called when the final chunk is - successfully written. - -Call this method to signal the end of the data being written to the -stream. - -### Event: 'drain' - -Emitted when the stream's write queue empties and it's safe to write -without buffering again. Listen for it when `stream.write()` returns -`false`. - -### Event: 'close' - -Emitted when the underlying resource (for example, the backing file -descriptor) has been closed. Not all streams will emit this. - -### Event: 'finish' - -When `end()` is called and there are no more chunks to write, this -event is emitted. - -### Event: 'pipe' - -* `source` {Readable Stream} - -Emitted when the stream is passed to a readable stream's pipe method. - -### Event 'unpipe' - -* `source` {Readable Stream} - -Emitted when a previously established `pipe()` is removed using the -source Readable stream's `unpipe()` method. - -## Class: stream.Duplex - - - -A "duplex" stream is one that is both Readable and Writable, such as a -TCP socket connection. - -Note that `stream.Duplex` is an abstract class designed to be -extended with an underlying implementation of the `_read(size)` -and `_write(chunk, encoding, callback)` methods as you would with a Readable or -Writable stream class. - -Since JavaScript doesn't have multiple prototypal inheritance, this -class prototypally inherits from Readable, and then parasitically from -Writable. It is thus up to the user to implement both the lowlevel -`_read(n)` method as well as the lowlevel `_write(chunk, encoding, cb)` method -on extension duplex classes. - -### new stream.Duplex(options) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `allowHalfOpen` {Boolean} Default=true. If set to `false`, then - the stream will automatically end the readable side when the - writable side ends and vice versa. - -In classes that extend the Duplex class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -## Class: stream.Transform - -A "transform" stream is a duplex stream where the output is causally -connected in some way to the input, such as a zlib stream or a crypto -stream. - -There is no requirement that the output be the same size as the input, -the same number of chunks, or arrive at the same time. For example, a -Hash stream will only ever have a single chunk of output which is -provided when the input is ended. A zlib stream will either produce -much smaller or much larger than its input. - -Rather than implement the `_read()` and `_write()` methods, Transform -classes must implement the `_transform()` method, and may optionally -also implement the `_flush()` method. (See below.) - -### new stream.Transform([options]) - -* `options` {Object} Passed to both Writable and Readable - constructors. - -In classes that extend the Transform class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### transform.\_transform(chunk, encoding, callback) - -* `chunk` {Buffer | String} The chunk to be transformed. Will always - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. (Ignore if `decodeStrings` chunk is a buffer.) -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Transform -class methods only. - -All Transform stream implementations must provide a `_transform` -method to accept input and produce output. - -`_transform` should do whatever has to be done in this specific -Transform class, to handle the bytes being written, and pass them off -to the readable portion of the interface. Do asynchronous I/O, -process things, and so on. - -Call `transform.push(outputChunk)` 0 or more times to generate output -from this input chunk, depending on how much data you want to output -as a result of this chunk. - -Call the callback function only when the current chunk is completely -consumed. Note that there may or may not be output as a result of any -particular input chunk. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -### transform.\_flush(callback) - -* `callback` {Function} Call this function (optionally with an error - argument) when you are done flushing any remaining data. - -Note: **This function MUST NOT be called directly.** It MAY be implemented -by child classes, and if so, will be called by the internal Transform -class methods only. - -In some cases, your transform operation may need to emit a bit more -data at the end of the stream. For example, a `Zlib` compression -stream will store up some internal state so that it can optimally -compress the output. At the end, however, it needs to do the best it -can with what is left, so that the data will be complete. - -In those cases, you can implement a `_flush` method, which will be -called at the very end, after all the written data is consumed, but -before emitting `end` to signal the end of the readable side. Just -like with `_transform`, call `transform.push(chunk)` zero or more -times, as appropriate, and call `callback` when the flush operation is -complete. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -### Example: `SimpleProtocol` parser - -The example above of a simple protocol parser can be implemented much -more simply by using the higher level `Transform` stream class. - -In this example, rather than providing the input as an argument, it -would be piped into the parser, which is a more idiomatic Node stream -approach. - -```javascript -function SimpleProtocol(options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Transform.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype = Object.create( - Transform.prototype, { constructor: { value: SimpleProtocol }}); - -SimpleProtocol.prototype._transform = function(chunk, encoding, done) { - if (!this._inBody) { - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // and let them know that we are done parsing the header. - this.emit('header', this.header); - - // now, because we got some extra data, emit this first. - this.push(b); - } - } else { - // from there on, just provide the data to our consumer as-is. - this.push(b); - } - done(); -}; - -var parser = new SimpleProtocol(); -source.pipe(parser) - -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - - -## Class: stream.PassThrough - -This is a trivial implementation of a `Transform` stream that simply -passes the input bytes across to the output. Its purpose is mainly -for examples and testing, but there are occasionally use cases where -it can come in handy. - - -[EventEmitter]: events.html#events_class_events_eventemitter diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/duplex.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/duplex.js deleted file mode 100644 index ca807af8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/duplex.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_duplex.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/float.patch b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/float.patch deleted file mode 100644 index b984607a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/float.patch +++ /dev/null @@ -1,923 +0,0 @@ -diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js -index c5a741c..a2e0d8e 100644 ---- a/lib/_stream_duplex.js -+++ b/lib/_stream_duplex.js -@@ -26,8 +26,8 @@ - - module.exports = Duplex; - var util = require('util'); --var Readable = require('_stream_readable'); --var Writable = require('_stream_writable'); -+var Readable = require('./_stream_readable'); -+var Writable = require('./_stream_writable'); - - util.inherits(Duplex, Readable); - -diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js -index a5e9864..330c247 100644 ---- a/lib/_stream_passthrough.js -+++ b/lib/_stream_passthrough.js -@@ -25,7 +25,7 @@ - - module.exports = PassThrough; - --var Transform = require('_stream_transform'); -+var Transform = require('./_stream_transform'); - var util = require('util'); - util.inherits(PassThrough, Transform); - -diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js -index 0c3fe3e..90a8298 100644 ---- a/lib/_stream_readable.js -+++ b/lib/_stream_readable.js -@@ -23,10 +23,34 @@ module.exports = Readable; - Readable.ReadableState = ReadableState; - - var EE = require('events').EventEmitter; -+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { -+ return emitter.listeners(type).length; -+}; -+ -+if (!global.setImmediate) global.setImmediate = function setImmediate(fn) { -+ return setTimeout(fn, 0); -+}; -+if (!global.clearImmediate) global.clearImmediate = function clearImmediate(i) { -+ return clearTimeout(i); -+}; -+ - var Stream = require('stream'); - var util = require('util'); -+if (!util.isUndefined) { -+ var utilIs = require('core-util-is'); -+ for (var f in utilIs) { -+ util[f] = utilIs[f]; -+ } -+} - var StringDecoder; --var debug = util.debuglog('stream'); -+var debug; -+if (util.debuglog) -+ debug = util.debuglog('stream'); -+else try { -+ debug = require('debuglog')('stream'); -+} catch (er) { -+ debug = function() {}; -+} - - util.inherits(Readable, Stream); - -@@ -380,7 +404,7 @@ function chunkInvalid(state, chunk) { - - - function onEofChunk(stream, state) { -- if (state.decoder && !state.ended) { -+ if (state.decoder && !state.ended && state.decoder.end) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); -diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js -index b1f9fcc..b0caf57 100644 ---- a/lib/_stream_transform.js -+++ b/lib/_stream_transform.js -@@ -64,8 +64,14 @@ - - module.exports = Transform; - --var Duplex = require('_stream_duplex'); -+var Duplex = require('./_stream_duplex'); - var util = require('util'); -+if (!util.isUndefined) { -+ var utilIs = require('core-util-is'); -+ for (var f in utilIs) { -+ util[f] = utilIs[f]; -+ } -+} - util.inherits(Transform, Duplex); - - -diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js -index ba2e920..f49288b 100644 ---- a/lib/_stream_writable.js -+++ b/lib/_stream_writable.js -@@ -27,6 +27,12 @@ module.exports = Writable; - Writable.WritableState = WritableState; - - var util = require('util'); -+if (!util.isUndefined) { -+ var utilIs = require('core-util-is'); -+ for (var f in utilIs) { -+ util[f] = utilIs[f]; -+ } -+} - var Stream = require('stream'); - - util.inherits(Writable, Stream); -@@ -119,7 +125,7 @@ function WritableState(options, stream) { - function Writable(options) { - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. -- if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) -+ if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex'))) - return new Writable(options); - - this._writableState = new WritableState(options, this); -diff --git a/test/simple/test-stream-big-push.js b/test/simple/test-stream-big-push.js -index e3787e4..8cd2127 100644 ---- a/test/simple/test-stream-big-push.js -+++ b/test/simple/test-stream-big-push.js -@@ -21,7 +21,7 @@ - - var common = require('../common'); - var assert = require('assert'); --var stream = require('stream'); -+var stream = require('../../'); - var str = 'asdfasdfasdfasdfasdf'; - - var r = new stream.Readable({ -diff --git a/test/simple/test-stream-end-paused.js b/test/simple/test-stream-end-paused.js -index bb73777..d40efc7 100644 ---- a/test/simple/test-stream-end-paused.js -+++ b/test/simple/test-stream-end-paused.js -@@ -25,7 +25,7 @@ var gotEnd = false; - - // Make sure we don't miss the end event for paused 0-length streams - --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - var stream = new Readable(); - var calledRead = false; - stream._read = function() { -diff --git a/test/simple/test-stream-pipe-after-end.js b/test/simple/test-stream-pipe-after-end.js -index b46ee90..0be8366 100644 ---- a/test/simple/test-stream-pipe-after-end.js -+++ b/test/simple/test-stream-pipe-after-end.js -@@ -22,8 +22,8 @@ - var common = require('../common'); - var assert = require('assert'); - --var Readable = require('_stream_readable'); --var Writable = require('_stream_writable'); -+var Readable = require('../../lib/_stream_readable'); -+var Writable = require('../../lib/_stream_writable'); - var util = require('util'); - - util.inherits(TestReadable, Readable); -diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js -deleted file mode 100644 -index f689358..0000000 ---- a/test/simple/test-stream-pipe-cleanup.js -+++ /dev/null -@@ -1,122 +0,0 @@ --// Copyright Joyent, Inc. and other Node contributors. --// --// 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. -- --// This test asserts that Stream.prototype.pipe does not leave listeners --// hanging on the source or dest. -- --var common = require('../common'); --var stream = require('stream'); --var assert = require('assert'); --var util = require('util'); -- --function Writable() { -- this.writable = true; -- this.endCalls = 0; -- stream.Stream.call(this); --} --util.inherits(Writable, stream.Stream); --Writable.prototype.end = function() { -- this.endCalls++; --}; -- --Writable.prototype.destroy = function() { -- this.endCalls++; --}; -- --function Readable() { -- this.readable = true; -- stream.Stream.call(this); --} --util.inherits(Readable, stream.Stream); -- --function Duplex() { -- this.readable = true; -- Writable.call(this); --} --util.inherits(Duplex, Writable); -- --var i = 0; --var limit = 100; -- --var w = new Writable(); -- --var r; -- --for (i = 0; i < limit; i++) { -- r = new Readable(); -- r.pipe(w); -- r.emit('end'); --} --assert.equal(0, r.listeners('end').length); --assert.equal(limit, w.endCalls); -- --w.endCalls = 0; -- --for (i = 0; i < limit; i++) { -- r = new Readable(); -- r.pipe(w); -- r.emit('close'); --} --assert.equal(0, r.listeners('close').length); --assert.equal(limit, w.endCalls); -- --w.endCalls = 0; -- --r = new Readable(); -- --for (i = 0; i < limit; i++) { -- w = new Writable(); -- r.pipe(w); -- w.emit('close'); --} --assert.equal(0, w.listeners('close').length); -- --r = new Readable(); --w = new Writable(); --var d = new Duplex(); --r.pipe(d); // pipeline A --d.pipe(w); // pipeline B --assert.equal(r.listeners('end').length, 2); // A.onend, A.cleanup --assert.equal(r.listeners('close').length, 2); // A.onclose, A.cleanup --assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup --assert.equal(d.listeners('close').length, 3); // A.cleanup, B.onclose, B.cleanup --assert.equal(w.listeners('end').length, 0); --assert.equal(w.listeners('close').length, 1); // B.cleanup -- --r.emit('end'); --assert.equal(d.endCalls, 1); --assert.equal(w.endCalls, 0); --assert.equal(r.listeners('end').length, 0); --assert.equal(r.listeners('close').length, 0); --assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup --assert.equal(d.listeners('close').length, 2); // B.onclose, B.cleanup --assert.equal(w.listeners('end').length, 0); --assert.equal(w.listeners('close').length, 1); // B.cleanup -- --d.emit('end'); --assert.equal(d.endCalls, 1); --assert.equal(w.endCalls, 1); --assert.equal(r.listeners('end').length, 0); --assert.equal(r.listeners('close').length, 0); --assert.equal(d.listeners('end').length, 0); --assert.equal(d.listeners('close').length, 0); --assert.equal(w.listeners('end').length, 0); --assert.equal(w.listeners('close').length, 0); -diff --git a/test/simple/test-stream-pipe-error-handling.js b/test/simple/test-stream-pipe-error-handling.js -index c5d724b..c7d6b7d 100644 ---- a/test/simple/test-stream-pipe-error-handling.js -+++ b/test/simple/test-stream-pipe-error-handling.js -@@ -21,7 +21,7 @@ - - var common = require('../common'); - var assert = require('assert'); --var Stream = require('stream').Stream; -+var Stream = require('../../').Stream; - - (function testErrorListenerCatches() { - var source = new Stream(); -diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js -index cb9d5fe..56f8d61 100644 ---- a/test/simple/test-stream-pipe-event.js -+++ b/test/simple/test-stream-pipe-event.js -@@ -20,7 +20,7 @@ - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var common = require('../common'); --var stream = require('stream'); -+var stream = require('../../'); - var assert = require('assert'); - var util = require('util'); - -diff --git a/test/simple/test-stream-push-order.js b/test/simple/test-stream-push-order.js -index f2e6ec2..a5c9bf9 100644 ---- a/test/simple/test-stream-push-order.js -+++ b/test/simple/test-stream-push-order.js -@@ -20,7 +20,7 @@ - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var common = require('../common.js'); --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - var assert = require('assert'); - - var s = new Readable({ -diff --git a/test/simple/test-stream-push-strings.js b/test/simple/test-stream-push-strings.js -index 06f43dc..1701a9a 100644 ---- a/test/simple/test-stream-push-strings.js -+++ b/test/simple/test-stream-push-strings.js -@@ -22,7 +22,7 @@ - var common = require('../common'); - var assert = require('assert'); - --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - var util = require('util'); - - util.inherits(MyStream, Readable); -diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js -index ba6a577..a8e6f7b 100644 ---- a/test/simple/test-stream-readable-event.js -+++ b/test/simple/test-stream-readable-event.js -@@ -22,7 +22,7 @@ - var common = require('../common'); - var assert = require('assert'); - --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - - (function first() { - // First test, not reading when the readable is added. -diff --git a/test/simple/test-stream-readable-flow-recursion.js b/test/simple/test-stream-readable-flow-recursion.js -index 2891ad6..11689ba 100644 ---- a/test/simple/test-stream-readable-flow-recursion.js -+++ b/test/simple/test-stream-readable-flow-recursion.js -@@ -27,7 +27,7 @@ var assert = require('assert'); - // more data continuously, but without triggering a nextTick - // warning or RangeError. - --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - - // throw an error if we trigger a nextTick warning. - process.throwDeprecation = true; -diff --git a/test/simple/test-stream-unshift-empty-chunk.js b/test/simple/test-stream-unshift-empty-chunk.js -index 0c96476..7827538 100644 ---- a/test/simple/test-stream-unshift-empty-chunk.js -+++ b/test/simple/test-stream-unshift-empty-chunk.js -@@ -24,7 +24,7 @@ var assert = require('assert'); - - // This test verifies that stream.unshift(Buffer(0)) or - // stream.unshift('') does not set state.reading=false. --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - - var r = new Readable(); - var nChunks = 10; -diff --git a/test/simple/test-stream-unshift-read-race.js b/test/simple/test-stream-unshift-read-race.js -index 83fd9fa..17c18aa 100644 ---- a/test/simple/test-stream-unshift-read-race.js -+++ b/test/simple/test-stream-unshift-read-race.js -@@ -29,7 +29,7 @@ var assert = require('assert'); - // 3. push() after the EOF signaling null is an error. - // 4. _read() is not called after pushing the EOF null chunk. - --var stream = require('stream'); -+var stream = require('../../'); - var hwm = 10; - var r = stream.Readable({ highWaterMark: hwm }); - var chunks = 10; -@@ -51,7 +51,14 @@ r._read = function(n) { - - function push(fast) { - assert(!pushedNull, 'push() after null push'); -- var c = pos >= data.length ? null : data.slice(pos, pos + n); -+ var c; -+ if (pos >= data.length) -+ c = null; -+ else { -+ if (n + pos > data.length) -+ n = data.length - pos; -+ c = data.slice(pos, pos + n); -+ } - pushedNull = c === null; - if (fast) { - pos += n; -diff --git a/test/simple/test-stream-writev.js b/test/simple/test-stream-writev.js -index 5b49e6e..b5321f3 100644 ---- a/test/simple/test-stream-writev.js -+++ b/test/simple/test-stream-writev.js -@@ -22,7 +22,7 @@ - var common = require('../common'); - var assert = require('assert'); - --var stream = require('stream'); -+var stream = require('../../'); - - var queue = []; - for (var decode = 0; decode < 2; decode++) { -diff --git a/test/simple/test-stream2-basic.js b/test/simple/test-stream2-basic.js -index 3814bf0..248c1be 100644 ---- a/test/simple/test-stream2-basic.js -+++ b/test/simple/test-stream2-basic.js -@@ -21,7 +21,7 @@ - - - var common = require('../common.js'); --var R = require('_stream_readable'); -+var R = require('../../lib/_stream_readable'); - var assert = require('assert'); - - var util = require('util'); -diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js -index 6cdd4e9..f0fa84b 100644 ---- a/test/simple/test-stream2-compatibility.js -+++ b/test/simple/test-stream2-compatibility.js -@@ -21,7 +21,7 @@ - - - var common = require('../common.js'); --var R = require('_stream_readable'); -+var R = require('../../lib/_stream_readable'); - var assert = require('assert'); - - var util = require('util'); -diff --git a/test/simple/test-stream2-finish-pipe.js b/test/simple/test-stream2-finish-pipe.js -index 39b274f..006a19b 100644 ---- a/test/simple/test-stream2-finish-pipe.js -+++ b/test/simple/test-stream2-finish-pipe.js -@@ -20,7 +20,7 @@ - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var common = require('../common.js'); --var stream = require('stream'); -+var stream = require('../../'); - var Buffer = require('buffer').Buffer; - - var r = new stream.Readable(); -diff --git a/test/simple/test-stream2-fs.js b/test/simple/test-stream2-fs.js -deleted file mode 100644 -index e162406..0000000 ---- a/test/simple/test-stream2-fs.js -+++ /dev/null -@@ -1,72 +0,0 @@ --// Copyright Joyent, Inc. and other Node contributors. --// --// 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. -- -- --var common = require('../common.js'); --var R = require('_stream_readable'); --var assert = require('assert'); -- --var fs = require('fs'); --var FSReadable = fs.ReadStream; -- --var path = require('path'); --var file = path.resolve(common.fixturesDir, 'x1024.txt'); -- --var size = fs.statSync(file).size; -- --var expectLengths = [1024]; -- --var util = require('util'); --var Stream = require('stream'); -- --util.inherits(TestWriter, Stream); -- --function TestWriter() { -- Stream.apply(this); -- this.buffer = []; -- this.length = 0; --} -- --TestWriter.prototype.write = function(c) { -- this.buffer.push(c.toString()); -- this.length += c.length; -- return true; --}; -- --TestWriter.prototype.end = function(c) { -- if (c) this.buffer.push(c.toString()); -- this.emit('results', this.buffer); --} -- --var r = new FSReadable(file); --var w = new TestWriter(); -- --w.on('results', function(res) { -- console.error(res, w.length); -- assert.equal(w.length, size); -- var l = 0; -- assert.deepEqual(res.map(function (c) { -- return c.length; -- }), expectLengths); -- console.log('ok'); --}); -- --r.pipe(w); -diff --git a/test/simple/test-stream2-httpclient-response-end.js b/test/simple/test-stream2-httpclient-response-end.js -deleted file mode 100644 -index 15cffc2..0000000 ---- a/test/simple/test-stream2-httpclient-response-end.js -+++ /dev/null -@@ -1,52 +0,0 @@ --// Copyright Joyent, Inc. and other Node contributors. --// --// 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. -- --var common = require('../common.js'); --var assert = require('assert'); --var http = require('http'); --var msg = 'Hello'; --var readable_event = false; --var end_event = false; --var server = http.createServer(function(req, res) { -- res.writeHead(200, {'Content-Type': 'text/plain'}); -- res.end(msg); --}).listen(common.PORT, function() { -- http.get({port: common.PORT}, function(res) { -- var data = ''; -- res.on('readable', function() { -- console.log('readable event'); -- readable_event = true; -- data += res.read(); -- }); -- res.on('end', function() { -- console.log('end event'); -- end_event = true; -- assert.strictEqual(msg, data); -- server.close(); -- }); -- }); --}); -- --process.on('exit', function() { -- assert(readable_event); -- assert(end_event); --}); -- -diff --git a/test/simple/test-stream2-large-read-stall.js b/test/simple/test-stream2-large-read-stall.js -index 2fbfbca..667985b 100644 ---- a/test/simple/test-stream2-large-read-stall.js -+++ b/test/simple/test-stream2-large-read-stall.js -@@ -30,7 +30,7 @@ var PUSHSIZE = 20; - var PUSHCOUNT = 1000; - var HWM = 50; - --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - var r = new Readable({ - highWaterMark: HWM - }); -@@ -39,23 +39,23 @@ var rs = r._readableState; - r._read = push; - - r.on('readable', function() { -- console.error('>> readable'); -+ //console.error('>> readable'); - do { -- console.error(' > read(%d)', READSIZE); -+ //console.error(' > read(%d)', READSIZE); - var ret = r.read(READSIZE); -- console.error(' < %j (%d remain)', ret && ret.length, rs.length); -+ //console.error(' < %j (%d remain)', ret && ret.length, rs.length); - } while (ret && ret.length === READSIZE); - -- console.error('<< after read()', -- ret && ret.length, -- rs.needReadable, -- rs.length); -+ //console.error('<< after read()', -+ // ret && ret.length, -+ // rs.needReadable, -+ // rs.length); - }); - - var endEmitted = false; - r.on('end', function() { - endEmitted = true; -- console.error('end'); -+ //console.error('end'); - }); - - var pushes = 0; -@@ -64,11 +64,11 @@ function push() { - return; - - if (pushes++ === PUSHCOUNT) { -- console.error(' push(EOF)'); -+ //console.error(' push(EOF)'); - return r.push(null); - } - -- console.error(' push #%d', pushes); -+ //console.error(' push #%d', pushes); - if (r.push(new Buffer(PUSHSIZE))) - setTimeout(push); - } -diff --git a/test/simple/test-stream2-objects.js b/test/simple/test-stream2-objects.js -index 3e6931d..ff47d89 100644 ---- a/test/simple/test-stream2-objects.js -+++ b/test/simple/test-stream2-objects.js -@@ -21,8 +21,8 @@ - - - var common = require('../common.js'); --var Readable = require('_stream_readable'); --var Writable = require('_stream_writable'); -+var Readable = require('../../lib/_stream_readable'); -+var Writable = require('../../lib/_stream_writable'); - var assert = require('assert'); - - // tiny node-tap lookalike. -diff --git a/test/simple/test-stream2-pipe-error-handling.js b/test/simple/test-stream2-pipe-error-handling.js -index cf7531c..e3f3e4e 100644 ---- a/test/simple/test-stream2-pipe-error-handling.js -+++ b/test/simple/test-stream2-pipe-error-handling.js -@@ -21,7 +21,7 @@ - - var common = require('../common'); - var assert = require('assert'); --var stream = require('stream'); -+var stream = require('../../'); - - (function testErrorListenerCatches() { - var count = 1000; -diff --git a/test/simple/test-stream2-pipe-error-once-listener.js b/test/simple/test-stream2-pipe-error-once-listener.js -index 5e8e3cb..53b2616 100755 ---- a/test/simple/test-stream2-pipe-error-once-listener.js -+++ b/test/simple/test-stream2-pipe-error-once-listener.js -@@ -24,7 +24,7 @@ var common = require('../common.js'); - var assert = require('assert'); - - var util = require('util'); --var stream = require('stream'); -+var stream = require('../../'); - - - var Read = function() { -diff --git a/test/simple/test-stream2-push.js b/test/simple/test-stream2-push.js -index b63edc3..eb2b0e9 100644 ---- a/test/simple/test-stream2-push.js -+++ b/test/simple/test-stream2-push.js -@@ -20,7 +20,7 @@ - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var common = require('../common.js'); --var stream = require('stream'); -+var stream = require('../../'); - var Readable = stream.Readable; - var Writable = stream.Writable; - var assert = require('assert'); -diff --git a/test/simple/test-stream2-read-sync-stack.js b/test/simple/test-stream2-read-sync-stack.js -index e8a7305..9740a47 100644 ---- a/test/simple/test-stream2-read-sync-stack.js -+++ b/test/simple/test-stream2-read-sync-stack.js -@@ -21,7 +21,7 @@ - - var common = require('../common'); - var assert = require('assert'); --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - var r = new Readable(); - var N = 256 * 1024; - -diff --git a/test/simple/test-stream2-readable-empty-buffer-no-eof.js b/test/simple/test-stream2-readable-empty-buffer-no-eof.js -index cd30178..4b1659d 100644 ---- a/test/simple/test-stream2-readable-empty-buffer-no-eof.js -+++ b/test/simple/test-stream2-readable-empty-buffer-no-eof.js -@@ -22,10 +22,9 @@ - var common = require('../common'); - var assert = require('assert'); - --var Readable = require('stream').Readable; -+var Readable = require('../../').Readable; - - test1(); --test2(); - - function test1() { - var r = new Readable(); -@@ -88,31 +87,3 @@ function test1() { - console.log('ok'); - }); - } -- --function test2() { -- var r = new Readable({ encoding: 'base64' }); -- var reads = 5; -- r._read = function(n) { -- if (!reads--) -- return r.push(null); // EOF -- else -- return r.push(new Buffer('x')); -- }; -- -- var results = []; -- function flow() { -- var chunk; -- while (null !== (chunk = r.read())) -- results.push(chunk + ''); -- } -- r.on('readable', flow); -- r.on('end', function() { -- results.push('EOF'); -- }); -- flow(); -- -- process.on('exit', function() { -- assert.deepEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]); -- console.log('ok'); -- }); --} -diff --git a/test/simple/test-stream2-readable-from-list.js b/test/simple/test-stream2-readable-from-list.js -index 7c96ffe..04a96f5 100644 ---- a/test/simple/test-stream2-readable-from-list.js -+++ b/test/simple/test-stream2-readable-from-list.js -@@ -21,7 +21,7 @@ - - var assert = require('assert'); - var common = require('../common.js'); --var fromList = require('_stream_readable')._fromList; -+var fromList = require('../../lib/_stream_readable')._fromList; - - // tiny node-tap lookalike. - var tests = []; -diff --git a/test/simple/test-stream2-readable-legacy-drain.js b/test/simple/test-stream2-readable-legacy-drain.js -index 675da8e..51fd3d5 100644 ---- a/test/simple/test-stream2-readable-legacy-drain.js -+++ b/test/simple/test-stream2-readable-legacy-drain.js -@@ -22,7 +22,7 @@ - var common = require('../common'); - var assert = require('assert'); - --var Stream = require('stream'); -+var Stream = require('../../'); - var Readable = Stream.Readable; - - var r = new Readable(); -diff --git a/test/simple/test-stream2-readable-non-empty-end.js b/test/simple/test-stream2-readable-non-empty-end.js -index 7314ae7..c971898 100644 ---- a/test/simple/test-stream2-readable-non-empty-end.js -+++ b/test/simple/test-stream2-readable-non-empty-end.js -@@ -21,7 +21,7 @@ - - var assert = require('assert'); - var common = require('../common.js'); --var Readable = require('_stream_readable'); -+var Readable = require('../../lib/_stream_readable'); - - var len = 0; - var chunks = new Array(10); -diff --git a/test/simple/test-stream2-readable-wrap-empty.js b/test/simple/test-stream2-readable-wrap-empty.js -index 2e5cf25..fd8a3dc 100644 ---- a/test/simple/test-stream2-readable-wrap-empty.js -+++ b/test/simple/test-stream2-readable-wrap-empty.js -@@ -22,7 +22,7 @@ - var common = require('../common'); - var assert = require('assert'); - --var Readable = require('_stream_readable'); -+var Readable = require('../../lib/_stream_readable'); - var EE = require('events').EventEmitter; - - var oldStream = new EE(); -diff --git a/test/simple/test-stream2-readable-wrap.js b/test/simple/test-stream2-readable-wrap.js -index 90eea01..6b177f7 100644 ---- a/test/simple/test-stream2-readable-wrap.js -+++ b/test/simple/test-stream2-readable-wrap.js -@@ -22,8 +22,8 @@ - var common = require('../common'); - var assert = require('assert'); - --var Readable = require('_stream_readable'); --var Writable = require('_stream_writable'); -+var Readable = require('../../lib/_stream_readable'); -+var Writable = require('../../lib/_stream_writable'); - var EE = require('events').EventEmitter; - - var testRuns = 0, completedRuns = 0; -diff --git a/test/simple/test-stream2-set-encoding.js b/test/simple/test-stream2-set-encoding.js -index 5d2c32a..685531b 100644 ---- a/test/simple/test-stream2-set-encoding.js -+++ b/test/simple/test-stream2-set-encoding.js -@@ -22,7 +22,7 @@ - - var common = require('../common.js'); - var assert = require('assert'); --var R = require('_stream_readable'); -+var R = require('../../lib/_stream_readable'); - var util = require('util'); - - // tiny node-tap lookalike. -diff --git a/test/simple/test-stream2-transform.js b/test/simple/test-stream2-transform.js -index 9c9ddd8..a0cacc6 100644 ---- a/test/simple/test-stream2-transform.js -+++ b/test/simple/test-stream2-transform.js -@@ -21,8 +21,8 @@ - - var assert = require('assert'); - var common = require('../common.js'); --var PassThrough = require('_stream_passthrough'); --var Transform = require('_stream_transform'); -+var PassThrough = require('../../').PassThrough; -+var Transform = require('../../').Transform; - - // tiny node-tap lookalike. - var tests = []; -diff --git a/test/simple/test-stream2-unpipe-drain.js b/test/simple/test-stream2-unpipe-drain.js -index d66dc3c..365b327 100644 ---- a/test/simple/test-stream2-unpipe-drain.js -+++ b/test/simple/test-stream2-unpipe-drain.js -@@ -22,7 +22,7 @@ - - var common = require('../common.js'); - var assert = require('assert'); --var stream = require('stream'); -+var stream = require('../../'); - var crypto = require('crypto'); - - var util = require('util'); -diff --git a/test/simple/test-stream2-unpipe-leak.js b/test/simple/test-stream2-unpipe-leak.js -index 99f8746..17c92ae 100644 ---- a/test/simple/test-stream2-unpipe-leak.js -+++ b/test/simple/test-stream2-unpipe-leak.js -@@ -22,7 +22,7 @@ - - var common = require('../common.js'); - var assert = require('assert'); --var stream = require('stream'); -+var stream = require('../../'); - - var chunk = new Buffer('hallo'); - -diff --git a/test/simple/test-stream2-writable.js b/test/simple/test-stream2-writable.js -index 704100c..209c3a6 100644 ---- a/test/simple/test-stream2-writable.js -+++ b/test/simple/test-stream2-writable.js -@@ -20,8 +20,8 @@ - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var common = require('../common.js'); --var W = require('_stream_writable'); --var D = require('_stream_duplex'); -+var W = require('../../').Writable; -+var D = require('../../').Duplex; - var assert = require('assert'); - - var util = require('util'); -diff --git a/test/simple/test-stream3-pause-then-read.js b/test/simple/test-stream3-pause-then-read.js -index b91bde3..2f72c15 100644 ---- a/test/simple/test-stream3-pause-then-read.js -+++ b/test/simple/test-stream3-pause-then-read.js -@@ -22,7 +22,7 @@ - var common = require('../common'); - var assert = require('assert'); - --var stream = require('stream'); -+var stream = require('../../'); - var Readable = stream.Readable; - var Writable = stream.Writable; - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_duplex.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index a2e0d8e0..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -module.exports = Duplex; -var util = require('util'); -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -Object.keys(Writable.prototype).forEach(function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; -}); - -function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_passthrough.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index 330c247d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); -var util = require('util'); -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_readable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index f50ea0f2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,924 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -module.exports = Readable; -Readable.ReadableState = ReadableState; - -var EE = require('events').EventEmitter; -if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; -}; - -if (!global.setImmediate) global.setImmediate = function setImmediate(fn) { - return setTimeout(fn, 0); -}; -if (!global.clearImmediate) global.clearImmediate = function clearImmediate(i) { - return clearTimeout(i); -}; - -var Stream = require('stream'); -var util = require('util'); -if (!util.isUndefined) { - var utilIs = require('core-util-is'); - for (var f in utilIs) { - util[f] = utilIs[f]; - } -} -var StringDecoder; -var debug; -if (util.debuglog) - debug = util.debuglog('stream'); -else try { - debug = require('debuglog')('stream'); -} catch (er) { - debug = function() {}; -} - -util.inherits(Readable, Stream); - -function ReadableState(options, stream) { - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (util.isString(chunk) && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (util.isNullOrUndefined(chunk)) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - - - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 128MB -var MAX_HWM = 0x800000; -function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (isNaN(n) || util.isNull(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (!util.isNumber(n) || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } - - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (util.isNull(ret)) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) - endReadable(this); - - if (!util.isNull(ret)) - this.emit('data', ret); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode && - !er) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - - -function onEofChunk(stream, state) { - if (state.decoder && !state.ended && state.decoder.end) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - debug('false write response, pause', - src._readableState.awaitDrain); - src._readableState.awaitDrain++; - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (Array.isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - - -Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = state.pipes.indexOf(dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - var self = this; - process.nextTick(function() { - debug('readable nexttick read 0'); - self.read(0); - }); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - if (!state.reading) { - debug('resume read 0'); - this.read(0); - } - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(function() { - resume_(stream, state); - }); - } -} - -function resume_(stream, state) { - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); -} - -Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); - } -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - events.forEach(function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - - - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_transform.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index b0caf57d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); -var util = require('util'); -if (!util.isUndefined) { - var utilIs = require('core-util-is'); - for (var f in utilIs) { - util[f] = utilIs[f]; - } -} -util.inherits(Transform, Duplex); - - -function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (!util.isNullOrUndefined(data)) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - - -function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('prefinish', function() { - if (util.isFunction(this._flush)) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); -} - -Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - - -function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_writable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index 1dfca70d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,460 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, cb), and it'll handle all -// the drain event emission and buffering. - -module.exports = Writable; -Writable.WritableState = WritableState; - -var util = require('util'); -if (!util.isUndefined) { - var utilIs = require('core-util-is'); - for (var f in utilIs) { - util[f] = utilIs[f]; - } -} -var Stream = require('stream'); - -util.inherits(Writable, Stream); - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; -} - -function WritableState(options, stream) { - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; -} - -function Writable(options) { - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex'))) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - - -function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; -} - -Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (util.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (!util.isFunction(cb)) - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function() { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function() { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && - !state.corked && - !state.finished && - !state.bufferProcessing && - state.buffer.length) - clearBuffer(this, state); - } -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - util.isString(chunk)) { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (util.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - state.needDrain = !ret; - - if (state.writing || state.corked) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, false, len, chunk, encoding, cb); - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - state.pendingcb--; - cb(er); - }); - else { - state.pendingcb--; - cb(er); - } - - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && - !state.corked && - !state.bufferProcessing && - state.buffer.length) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - - if (stream._writev && state.buffer.length > 1) { - // Fast case, write everything using _writev() - var cbs = []; - for (var c = 0; c < state.buffer.length; c++) - cbs.push(state.buffer[c].callback); - - // count the one we are adding, as well. - // TODO(isaacs) clean this up - state.pendingcb++; - doWrite(stream, state, true, state.length, state.buffer, '', function(err) { - for (var i = 0; i < cbs.length; i++) { - state.pendingcb--; - cbs[i](err); - } - }); - - // Clear buffer - state.buffer = []; - } else { - // Slow case, write chunks one-by-one - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; - } - - state.bufferProcessing = false; -} - -Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); - -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (util.isFunction(chunk)) { - cb = chunk; - chunk = null; - encoding = null; - } else if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (!util.isNullOrUndefined(chunk)) - this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); -}; - - -function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); -} - -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } -} - -function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else - prefinish(stream, state); - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/README.md deleted file mode 100644 index 5a76b414..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# core-util-is - -The `util.is*` functions introduced in Node v0.12. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/float.patch b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/float.patch deleted file mode 100644 index a06d5c05..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/float.patch +++ /dev/null @@ -1,604 +0,0 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- 'bold' : [1, 22], -- 'italic' : [3, 23], -- 'underline' : [4, 24], -- 'inverse' : [7, 27], -- 'white' : [37, 39], -- 'grey' : [90, 39], -- 'black' : [30, 39], -- 'blue' : [34, 39], -- 'cyan' : [36, 39], -- 'green' : [32, 39], -- 'magenta' : [35, 39], -- 'red' : [31, 39], -- 'yellow' : [33, 39] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; -+} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/lib/util.js deleted file mode 100644 index 9074e8eb..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return Buffer.isBuffer(arg); -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/package.json deleted file mode 100644 index 4114d29c..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "core-util-is", - "version": "1.0.1", - "description": "The `util.is*` functions introduced in Node v0.12.", - "main": "lib/util.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/core-util-is" - }, - "keywords": [ - "util", - "isBuffer", - "isArray", - "isNumber", - "isString", - "isRegExp", - "isThis", - "isThat", - "polyfill" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/core-util-is/issues" - }, - "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", - "readmeFilename": "README.md", - "_id": "core-util-is@1.0.1", - "dist": { - "shasum": "bd815063f8aadddea630e8412d0708c753aabd57" - }, - "_from": "core-util-is@~1.0.0", - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/util.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/util.js deleted file mode 100644 index 007fa105..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/core-util-is/util.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && objectToString(e) === '[object Error]'; -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return arg instanceof Buffer; -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/LICENSE deleted file mode 100644 index a3187cc1..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. All rights reserved. - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/README.md deleted file mode 100644 index dc6fccec..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# debuglog - backport of util.debuglog() from node v0.11 - -To facilitate using the `util.debuglog()` function that will be available when -node v0.12 is released now, this is a copy extracted from the source. - -## require('debuglog') - -Return `util.debuglog`, if it exists, otherwise it will return an internal copy -of the implementation from node v0.11. - -## debuglog(section) - -* `section` {String} The section of the program to be debugged -* Returns: {Function} The logging function - -This is used to create a function which conditionally writes to stderr -based on the existence of a `NODE_DEBUG` environment variable. If the -`section` name appears in that environment variable, then the returned -function will be similar to `console.error()`. If not, then the -returned function is a no-op. - -For example: - -```javascript -var debuglog = util.debuglog('foo'); - -var bar = 123; -debuglog('hello from foo [%d]', bar); -``` - -If this program is run with `NODE_DEBUG=foo` in the environment, then -it will output something like: - - FOO 3245: hello from foo [123] - -where `3245` is the process id. If it is not run with that -environment variable set, then it will not print anything. - -You may separate multiple `NODE_DEBUG` environment variables with a -comma. For example, `NODE_DEBUG=fs,net,tls`. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/debuglog.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/debuglog.js deleted file mode 100644 index da465c29..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/debuglog.js +++ /dev/null @@ -1,22 +0,0 @@ -var util = require('util'); - -module.exports = util.debuglog || debuglog; - -var debugs = {}; -var debugEnviron = process.env.NODE_DEBUG || ''; - -function debuglog(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = util.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/package.json deleted file mode 100644 index 7582bdfd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "debuglog", - "version": "0.0.2", - "description": "backport of util.debuglog from node v0.11", - "license": "MIT", - "main": "debuglog.js", - "repository": { - "type": "git", - "url": "https://github.com/sam-github/node-debuglog.git" - }, - "author": { - "name": "Sam Roberts", - "email": "sam@strongloop.com" - }, - "engines": { - "node": "*" - }, - "readme": "# debuglog - backport of util.debuglog() from node v0.11\n\nTo facilitate using the `util.debuglog()` function that will be available when\nnode v0.12 is released now, this is a copy extracted from the source.\n\n## require('debuglog')\n\nReturn `util.debuglog`, if it exists, otherwise it will return an internal copy\nof the implementation from node v0.11.\n\n## debuglog(section)\n\n* `section` {String} The section of the program to be debugged\n* Returns: {Function} The logging function\n\nThis is used to create a function which conditionally writes to stderr\nbased on the existence of a `NODE_DEBUG` environment variable. If the\n`section` name appears in that environment variable, then the returned\nfunction will be similar to `console.error()`. If not, then the\nreturned function is a no-op.\n\nFor example:\n\n```javascript\nvar debuglog = util.debuglog('foo');\n\nvar bar = 123;\ndebuglog('hello from foo [%d]', bar);\n```\n\nIf this program is run with `NODE_DEBUG=foo` in the environment, then\nit will output something like:\n\n FOO 3245: hello from foo [123]\n\nwhere `3245` is the process id. If it is not run with that\nenvironment variable set, then it will not print anything.\n\nYou may separate multiple `NODE_DEBUG` environment variables with a\ncomma. For example, `NODE_DEBUG=fs,net,tls`.\n", - "readmeFilename": "README.md", - "_id": "debuglog@0.0.2", - "dist": { - "shasum": "50e76262c774c0480f9537a6f7b7991d54c9135e" - }, - "_from": "debuglog@0.0.2", - "_resolved": "https://registry.npmjs.org/debuglog/-/debuglog-0.0.2.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/.npmignore deleted file mode 100644 index b512c09d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/LICENSE deleted file mode 100644 index 6de584a4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/README.md deleted file mode 100644 index 4d2aa001..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/README.md +++ /dev/null @@ -1,7 +0,0 @@ -**string_decoder.js** (`require('string_decoder')`) from Node.js core - -Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. - -Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** - -The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/build.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/build.js deleted file mode 100644 index 46470cfd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/build.js +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env node - -const hyperquest = require('hyperzip')(require('hyperdirect')) - , bl = require('bl') - , fs = require('fs') - , path = require('path') - , cheerio = require('cheerio') - - , files = require('./files') - , testReplace = require('./test-replacements') - - , srcurlpfx = 'https://raw.github.com/joyent/node/v' + process.argv[2] + '-release/' - , libsrcurl = srcurlpfx + 'lib/' - , testsrcurl = srcurlpfx + 'test/simple/' - , testlisturl = 'https://github.com/joyent/node/tree/v' + process.argv[2] + '-release/test/simple' - , libourroot = path.join(__dirname, '../') - , testourroot = path.join(__dirname, '../test/simple/') - - -function processFile (url, out, replacements) { - hyperquest(url).pipe(bl(function (err, data) { - if (err) - throw err - - data = data.toString() - replacements.forEach(function (replacement) { - data = data.replace.apply(data, replacement) - }) - - fs.writeFile(out, data, 'utf8', function (err) { - if (err) - throw err - - console.log('Wrote', out) - }) - })) -} - -function processLibFile (file) { - var replacements = files[file] - , url = libsrcurl + file - , out = path.join(libourroot, replacements.out || file) - - processFile(url, out, replacements) -} - - -function processTestFile (file) { - var replacements = testReplace.all - , url = testsrcurl + file - , out = path.join(testourroot, file) - - if (testReplace[file]) - replacements = replacements.concat(testReplace[file]) - - processFile(url, out, replacements) -} - - -if (!/0\.1\d\.\d+/.test(process.argv[2])) { - console.log('Usage: build.js ') - return process.exit(-1) -} - - -//-------------------------------------------------------------------- -// Grab & process files in ../lib/ - -Object.keys(files).forEach(processLibFile) - -//-------------------------------------------------------------------- -// Discover, grab and process all test-string-decoder* files on joyent/node - -hyperquest(testlisturl).pipe(bl(function (err, data) { - if (err) - throw err - - var $ = cheerio.load(data.toString()) - - $('table.files .js-directory-link').each(function () { - var file = $(this).text() - if (/^test-string-decoder/.test(file) || file == 'common.js') - processTestFile(file) - }) -})) - -//-------------------------------------------------------------------- -// Grab the joyent/node test/common.js - -processFile( - testsrcurl + '../common.js' - , path.join(testourroot, '../common.js') - , testReplace['common.js'] -) \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/files.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/files.js deleted file mode 100644 index 7396a4f4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/files.js +++ /dev/null @@ -1,36 +0,0 @@ -/* This file lists the files to be fetched from the node repo - * in the /lib/ directory which will be placed in the ../lib/ - * directory after having each of the "replacements" in the - * array for that file applied to it. The replacements are - * simply the arguments to String#replace, so they can be - * strings, regexes, functions. - */ - -module.exports['string_decoder.js'] = [ - - // pull in Bufer as a require - // add Buffer.isEncoding where missing - [ - /^(\/\/ USE OR OTHER DEALINGS IN THE SOFTWARE\.)/m - , '$1\n\nvar Buffer = require(\'buffer\').Buffer;' - + '\n' - + '\nvar isBufferEncoding = Buffer.isEncoding' - + '\n || function(encoding) {' - + '\n switch (encoding && encoding.toLowerCase()) {' - + '\n case \'hex\': case \'utf8\': case \'utf-8\': case \'ascii\': case \'binary\': case \'base64\': case \'ucs2\': case \'ucs-2\': case \'utf16le\': case \'utf-16le\': case \'raw\': return true;' - + '\n default: return false;' - + '\n }' - + '\n }' - + '\n' - - ] - - // use custom Buffer.isEncoding reference - , [ - /Buffer\.isEncoding\(/g - , 'isBufferEncoding\(' - ] - -] - -module.exports['string_decoder.js'].out = 'index.js' \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.jshintrc b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.jshintrc deleted file mode 100644 index c8ef3ca4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.jshintrc +++ /dev/null @@ -1,59 +0,0 @@ -{ - "predef": [ ] - , "bitwise": false - , "camelcase": false - , "curly": false - , "eqeqeq": false - , "forin": false - , "immed": false - , "latedef": false - , "noarg": true - , "noempty": true - , "nonew": true - , "plusplus": false - , "quotmark": true - , "regexp": false - , "undef": true - , "unused": true - , "strict": false - , "trailing": true - , "maxlen": 120 - , "asi": true - , "boss": true - , "debug": true - , "eqnull": true - , "esnext": true - , "evil": true - , "expr": true - , "funcscope": false - , "globalstrict": false - , "iterator": false - , "lastsemic": true - , "laxbreak": true - , "laxcomma": true - , "loopfunc": true - , "multistr": false - , "onecase": false - , "proto": false - , "regexdash": false - , "scripturl": true - , "smarttabs": false - , "shadow": false - , "sub": true - , "supernew": false - , "validthis": true - , "browser": true - , "couch": false - , "devel": false - , "dojo": false - , "mootools": false - , "node": true - , "nonstandard": true - , "prototypejs": false - , "rhino": false - , "worker": true - , "wsh": false - , "nomen": false - , "onevar": false - , "passfail": false -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.npmignore deleted file mode 100644 index 40b878db..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.travis.yml deleted file mode 100644 index 7ddb9c97..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.8 - - "0.10" -branches: - only: - - master -notifications: - email: - - rod@vagg.org -script: npm test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/LICENSE deleted file mode 100644 index f6a0029d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/LICENSE +++ /dev/null @@ -1,39 +0,0 @@ -Copyright 2013, Rod Vagg (the "Original Author") -All rights reserved. - -MIT +no-false-attribs License - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -Distributions of all or part of the Software intended to be used -by the recipients as they would use the unmodified Software, -containing modifications that substantially alter, remove, or -disable functionality of the Software, outside of the documented -configuration mechanisms provided by the Software, shall be -modified such that the Original Author's bug reporting email -addresses and urls are either replaced with the contact information -of the parties responsible for the changes, or removed entirely. - -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. - - -Except where noted, this license applies to any and all software -programs and associated documentation files created by the -Original Author, when distributed with the Software. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/README.md deleted file mode 100644 index 264c46e4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# bl *(BufferList)* - -[![Build Status](https://secure.travis-ci.org/rvagg/bl.png)](http://travis-ci.org/rvagg/bl) - -**A Node.js Buffer list collector, reader and streamer thingy.** - -**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them! - -The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently. - -```js -const BufferList = require('bl') - -var bl = new BufferList() -bl.append(new Buffer('abcd')) -bl.append(new Buffer('efg')) -bl.append('hi') // bl will also accept & convert Strings -bl.append(new Buffer('j')) -bl.append(new Buffer([ 0x3, 0x4 ])) - -console.log(bl.length) // 12 - -console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij' -console.log(bl.slice(3, 10).toString('ascii')) // 'defghij' -console.log(bl.slice(3, 6).toString('ascii')) // 'def' -console.log(bl.slice(3, 8).toString('ascii')) // 'defgh' -console.log(bl.slice(5, 10).toString('ascii')) // 'fghij' - -// or just use toString! -console.log(bl.toString()) // 'abcdefghij\u0003\u0004' -console.log(bl.toString('ascii', 3, 8)) // 'defgh' -console.log(bl.toString('ascii', 5, 10)) // 'fghij' - -// other standard Buffer readables -console.log(bl.readUInt16BE(10)) // 0x0304 -console.log(bl.readUInt16LE(10)) // 0x0403 -``` - -Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**: - -```js -const bl = require('bl') - , fs = require('fs') - -fs.createReadStream('README.md') - .pipe(bl(function (err, data) { // note 'new' isn't strictly required - // `data` is a complete Buffer object containing the full data - console.log(data.toString()) - }) -``` - -Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream. - -Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!): -```js -const hyperquest = require('hyperquest') - , bl = require('bl') - , url = 'https://raw.github.com/rvagg/bl/master/README.md' - -hyperquest(url).pipe(bl(function (err, data) { - console.log(data.toString()) -})) -``` - -Or, use it as a readable stream to recompose a list of Buffers to an output source: - -```js -const BufferList = require('bl') - , fs = require('fs') - -var bl = new BufferList() -bl.append(new Buffer('abcd')) -bl.append(new Buffer('efg')) -bl.append(new Buffer('hi')) -bl.append(new Buffer('j')) - -bl.pipe(fs.createWriteStream('gibberish.txt')) -``` - -## API - - * new BufferList([ callback ]) - * bl.length - * bl.append(buffer) - * bl.get(index) - * bl.slice([ start[, end ] ]) - * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) - * bl.duplicate() - * bl.consume(bytes) - * bl.toString([encoding, [ start, [ end ]]]) - * bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() - * Streams - --------------------------------------------------------- - -### new BufferList([ callback | buffer | buffer array ]) -The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream. - -Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object. - -`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: - -```js -var bl = require('bl') -var myinstance = bl() - -// equivilant to: - -var BufferList = require('bl') -var myinstance = new BufferList() -``` - --------------------------------------------------------- - -### bl.length -Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list. - --------------------------------------------------------- - -### bl.append(buffer) -`append(buffer)` adds an additional buffer to the internal list. - --------------------------------------------------------- - -### bl.get(index) -`get()` will return the byte at the specified index. - --------------------------------------------------------- - -### bl.slice([ start, [ end ] ]) -`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively. - -If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer. - --------------------------------------------------------- - -### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) -`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively. - --------------------------------------------------------- - -### bl.duplicate() -`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example: - -```js -var bl = new BufferList() - -bl.append('hello') -bl.append(' world') -bl.append('\n') - -bl.duplicate().pipe(process.stdout, { end: false }) - -console.log(bl.toString()) -``` - --------------------------------------------------------- - -### bl.consume(bytes) -`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data. - --------------------------------------------------------- - -### bl.toString([encoding, [ start, [ end ]]]) -`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information. - --------------------------------------------------------- - -### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() - -All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently. - -See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - --------------------------------------------------------- - -### Streams -**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance. - --------------------------------------------------------- - -## Contributors - -**bl** is brought to you by the following hackers: - - * [Rod Vagg](https://github.com/rvagg) - * [Matteo Collina](https://github.com/mcollina) - -======= - -## License - -**bl** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/bl.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/bl.js deleted file mode 100644 index 192e16b9..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/bl.js +++ /dev/null @@ -1,205 +0,0 @@ -const DuplexStream = require('stream').DuplexStream || require('readable-stream/duplex') - , util = require('util') - -function BufferList (callback) { - if (!(this instanceof BufferList)) - return new BufferList(callback) - - this._bufs = [] - this.length = 0 - - if (typeof callback == 'function') { - this._callback = callback - - var piper = function (err) { - if (this._callback) { - this._callback(err) - this._callback = null - } - }.bind(this) - - this.on('pipe', function (src) { - src.on('error', piper) - }) - this.on('unpipe', function (src) { - src.removeListener('error', piper) - }) - } - else if (Buffer.isBuffer(callback)) - this.append(callback) - else if (Array.isArray(callback)) { - callback.forEach(function (b) { - Buffer.isBuffer(b) && this.append(b) - }.bind(this)) - } - - DuplexStream.call(this) -} - -util.inherits(BufferList, DuplexStream) - -BufferList.prototype._offset = function (offset) { - var tot = 0, i = 0, _t - for (; i < this._bufs.length; i++) { - _t = tot + this._bufs[i].length - if (offset < _t) - return [ i, offset - tot ] - tot = _t - } -} - -BufferList.prototype.append = function (buf) { - this._bufs.push(Buffer.isBuffer(buf) ? buf : new Buffer(buf)) - this.length += buf.length - return this -} - -BufferList.prototype._write = function (buf, encoding, callback) { - this.append(buf) - if (callback) - callback() -} - -BufferList.prototype._read = function (size) { - if (!this.length) - return this.push(null) - size = Math.min(size, this.length) - this.push(this.slice(0, size)) - this.consume(size) -} - -BufferList.prototype.end = function (chunk) { - DuplexStream.prototype.end.call(this, chunk) - - if (this._callback) { - this._callback(null, this.slice()) - this._callback = null - } -} - -BufferList.prototype.get = function (index) { - return this.slice(index, index + 1)[0] -} - -BufferList.prototype.slice = function (start, end) { - return this.copy(null, 0, start, end) -} - -BufferList.prototype.copy = function (dst, dstStart, srcStart, srcEnd) { - if (typeof srcStart != 'number' || srcStart < 0) - srcStart = 0 - if (typeof srcEnd != 'number' || srcEnd > this.length) - srcEnd = this.length - if (srcStart >= this.length) - return dst || new Buffer(0) - if (srcEnd <= 0) - return dst || new Buffer(0) - - var copy = !!dst - , off = this._offset(srcStart) - , len = srcEnd - srcStart - , bytes = len - , bufoff = (copy && dstStart) || 0 - , start = off[1] - , l - , i - - // copy/slice everything - if (srcStart === 0 && srcEnd == this.length) { - if (!copy) // slice, just return a full concat - return Buffer.concat(this._bufs) - - // copy, need to copy individual buffers - for (i = 0; i < this._bufs.length; i++) { - this._bufs[i].copy(dst, bufoff) - bufoff += this._bufs[i].length - } - - return dst - } - - // easy, cheap case where it's a subset of one of the buffers - if (bytes <= this._bufs[off[0]].length - start) { - return copy - ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) - : this._bufs[off[0]].slice(start, start + bytes) - } - - if (!copy) // a slice, we need something to copy in to - dst = new Buffer(len) - - for (i = off[0]; i < this._bufs.length; i++) { - l = this._bufs[i].length - start - - if (bytes > l) { - this._bufs[i].copy(dst, bufoff, start) - } else { - this._bufs[i].copy(dst, bufoff, start, start + bytes) - break - } - - bufoff += l - bytes -= l - - if (start) - start = 0 - } - - return dst -} - -BufferList.prototype.toString = function (encoding, start, end) { - return this.slice(start, end).toString(encoding) -} - -BufferList.prototype.consume = function (bytes) { - while (this._bufs.length) { - if (bytes > this._bufs[0].length) { - bytes -= this._bufs[0].length - this.length -= this._bufs[0].length - this._bufs.shift() - } else { - this._bufs[0] = this._bufs[0].slice(bytes) - this.length -= bytes - break - } - } - return this -} - -BufferList.prototype.duplicate = function () { - var i = 0 - , copy = new BufferList() - - for (; i < this._bufs.length; i++) - copy.append(this._bufs[i]) - - return copy -} - -;(function () { - var methods = { - 'readDoubleBE' : 8 - , 'readDoubleLE' : 8 - , 'readFloatBE' : 4 - , 'readFloatLE' : 4 - , 'readInt32BE' : 4 - , 'readInt32LE' : 4 - , 'readUInt32BE' : 4 - , 'readUInt32LE' : 4 - , 'readInt16BE' : 2 - , 'readInt16LE' : 2 - , 'readUInt16BE' : 2 - , 'readUInt16LE' : 2 - , 'readInt8' : 1 - , 'readUInt8' : 1 - } - - Object.keys(methods).forEach(function (m) { - BufferList.prototype[m] = function (offset) { - return this.slice(offset, offset + methods[m])[m](0) - } - }) -}()) - -module.exports = BufferList diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/LICENSE deleted file mode 100644 index 0c44ae71..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/README.md deleted file mode 100644 index be976683..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/README.md +++ /dev/null @@ -1,768 +0,0 @@ -# readable-stream - -A new class of streams for Node.js - -This module provides the new Stream base classes introduced in Node -v0.10, for use in Node v0.8. You can use it to have programs that -have to work with node v0.8, while being forward-compatible for v0.10 -and beyond. When you drop support for v0.8, you can remove this -module, and only use the native streams. - -This is almost exactly the same codebase as appears in Node v0.10. -However: - -1. The exported object is actually the Readable class. Decorating the - native `stream` module would be global pollution. -2. In v0.10, you can safely use `base64` as an argument to - `setEncoding` in Readable streams. However, in v0.8, the - StringDecoder class has no `end()` method, which is problematic for - Base64. So, don't use that, because it'll break and be weird. - -Other than that, the API is the same as `require('stream')` in v0.10, -so the API docs are reproduced below. - ----------- - - Stability: 2 - Unstable - -A stream is an abstract interface implemented by various objects in -Node. For example a request to an HTTP server is a stream, as is -stdout. Streams are readable, writable, or both. All streams are -instances of [EventEmitter][] - -You can load the Stream base classes by doing `require('stream')`. -There are base classes provided for Readable streams, Writable -streams, Duplex streams, and Transform streams. - -## Compatibility - -In earlier versions of Node, the Readable stream interface was -simpler, but also less powerful and less useful. - -* Rather than waiting for you to call the `read()` method, `'data'` - events would start emitting immediately. If you needed to do some - I/O to decide how to handle data, then you had to store the chunks - in some kind of buffer so that they would not be lost. -* The `pause()` method was advisory, rather than guaranteed. This - meant that you still had to be prepared to receive `'data'` events - even when the stream was in a paused state. - -In Node v0.10, the Readable class described below was added. For -backwards compatibility with older Node programs, Readable streams -switch into "old mode" when a `'data'` event handler is added, or when -the `pause()` or `resume()` methods are called. The effect is that, -even if you are not using the new `read()` method and `'readable'` -event, you no longer have to worry about losing `'data'` chunks. - -Most programs will continue to function normally. However, this -introduces an edge case in the following conditions: - -* No `'data'` event handler is added. -* The `pause()` and `resume()` methods are never called. - -For example, consider the following code: - -```javascript -// WARNING! BROKEN! -net.createServer(function(socket) { - - // we add an 'end' method, but never consume the data - socket.on('end', function() { - // It will never get here. - socket.end('I got your message (but didnt read it)\n'); - }); - -}).listen(1337); -``` - -In versions of node prior to v0.10, the incoming message data would be -simply discarded. However, in Node v0.10 and beyond, the socket will -remain paused forever. - -The workaround in this situation is to call the `resume()` method to -trigger "old mode" behavior: - -```javascript -// Workaround -net.createServer(function(socket) { - - socket.on('end', function() { - socket.end('I got your message (but didnt read it)\n'); - }); - - // start the flow of data, discarding it. - socket.resume(); - -}).listen(1337); -``` - -In addition to new Readable streams switching into old-mode, pre-v0.10 -style streams can be wrapped in a Readable class using the `wrap()` -method. - -## Class: stream.Readable - - - -A `Readable Stream` has the following methods, members, and events. - -Note that `stream.Readable` is an abstract class designed to be -extended with an underlying implementation of the `_read(size)` -method. (See below.) - -### new stream.Readable([options]) - -* `options` {Object} - * `highWaterMark` {Number} The maximum number of bytes to store in - the internal buffer before ceasing to read from the underlying - resource. Default=16kb - * `encoding` {String} If specified, then buffers will be decoded to - strings using the specified encoding. Default=null - * `objectMode` {Boolean} Whether this stream should behave - as a stream of objects. Meaning that stream.read(n) returns - a single value instead of a Buffer of size n - -In classes that extend the Readable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### readable.\_read(size) - -* `size` {Number} Number of bytes to read asynchronously - -Note: **This function should NOT be called directly.** It should be -implemented by child classes, and called by the internal Readable -class methods only. - -All Readable stream implementations must provide a `_read` method -to fetch data from the underlying resource. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -When data is available, put it into the read queue by calling -`readable.push(chunk)`. If `push` returns false, then you should stop -reading. When `_read` is called again, you should start pushing more -data. - -The `size` argument is advisory. Implementations where a "read" is a -single call that returns data can use this to know how much data to -fetch. Implementations where that is not relevant, such as TCP or -TLS, may ignore this argument, and simply provide data whenever it -becomes available. There is no need, for example to "wait" until -`size` bytes are available before calling `stream.push(chunk)`. - -### readable.push(chunk) - -* `chunk` {Buffer | null | String} Chunk of data to push into the read queue -* return {Boolean} Whether or not more pushes should be performed - -Note: **This function should be called by Readable implementors, NOT -by consumers of Readable subclasses.** The `_read()` function will not -be called again until at least one `push(chunk)` call is made. If no -data is available, then you MAY call `push('')` (an empty string) to -allow a future `_read` call, without adding any data to the queue. - -The `Readable` class works by putting data into a read queue to be -pulled out later by calling the `read()` method when the `'readable'` -event fires. - -The `push()` method will explicitly insert some data into the read -queue. If it is called with `null` then it will signal the end of the -data. - -In some cases, you may be wrapping a lower-level source which has some -sort of pause/resume mechanism, and a data callback. In those cases, -you could wrap the low-level source object by doing something like -this: - -```javascript -// source is an object with readStop() and readStart() methods, -// and an `ondata` member that gets called when it has data, and -// an `onend` member that gets called when the data is over. - -var stream = new Readable(); - -source.ondata = function(chunk) { - // if push() returns false, then we need to stop reading from source - if (!stream.push(chunk)) - source.readStop(); -}; - -source.onend = function() { - stream.push(null); -}; - -// _read will be called when the stream wants to pull more data in -// the advisory size argument is ignored in this case. -stream._read = function(n) { - source.readStart(); -}; -``` - -### readable.unshift(chunk) - -* `chunk` {Buffer | null | String} Chunk of data to unshift onto the read queue -* return {Boolean} Whether or not more pushes should be performed - -This is the corollary of `readable.push(chunk)`. Rather than putting -the data at the *end* of the read queue, it puts it at the *front* of -the read queue. - -This is useful in certain use-cases where a stream is being consumed -by a parser, which needs to "un-consume" some data that it has -optimistically pulled out of the source. - -```javascript -// A parser for a simple data protocol. -// The "header" is a JSON object, followed by 2 \n characters, and -// then a message body. -// -// Note: This can be done more simply as a Transform stream. See below. - -function SimpleProtocol(source, options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Readable.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - - // source is a readable stream, such as a socket or file - this._source = source; - - var self = this; - source.on('end', function() { - self.push(null); - }); - - // give it a kick whenever the source is readable - // read(0) will not consume any bytes - source.on('readable', function() { - self.read(0); - }); - - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype = Object.create( - Readable.prototype, { constructor: { value: SimpleProtocol }}); - -SimpleProtocol.prototype._read = function(n) { - if (!this._inBody) { - var chunk = this._source.read(); - - // if the source doesn't have data, we don't have data yet. - if (chunk === null) - return this.push(''); - - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - this.push(''); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // now, because we got some extra data, unshift the rest - // back into the read queue so that our consumer will see it. - var b = chunk.slice(split); - this.unshift(b); - - // and let them know that we are done parsing the header. - this.emit('header', this.header); - } - } else { - // from there on, just provide the data to our consumer. - // careful not to push(null), since that would indicate EOF. - var chunk = this._source.read(); - if (chunk) this.push(chunk); - } -}; - -// Usage: -var parser = new SimpleProtocol(source); -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### readable.wrap(stream) - -* `stream` {Stream} An "old style" readable stream - -If you are using an older Node library that emits `'data'` events and -has a `pause()` method that is advisory only, then you can use the -`wrap()` method to create a Readable stream that uses the old stream -as its data source. - -For example: - -```javascript -var OldReader = require('./old-api-module.js').OldReader; -var oreader = new OldReader; -var Readable = require('stream').Readable; -var myReader = new Readable().wrap(oreader); - -myReader.on('readable', function() { - myReader.read(); // etc. -}); -``` - -### Event: 'readable' - -When there is data ready to be consumed, this event will fire. - -When this event emits, call the `read()` method to consume the data. - -### Event: 'end' - -Emitted when the stream has received an EOF (FIN in TCP terminology). -Indicates that no more `'data'` events will happen. If the stream is -also writable, it may be possible to continue writing. - -### Event: 'data' - -The `'data'` event emits either a `Buffer` (by default) or a string if -`setEncoding()` was used. - -Note that adding a `'data'` event listener will switch the Readable -stream into "old mode", where data is emitted as soon as it is -available, rather than waiting for you to call `read()` to consume it. - -### Event: 'error' - -Emitted if there was an error receiving data. - -### Event: 'close' - -Emitted when the underlying resource (for example, the backing file -descriptor) has been closed. Not all streams will emit this. - -### readable.setEncoding(encoding) - -Makes the `'data'` event emit a string instead of a `Buffer`. `encoding` -can be `'utf8'`, `'utf16le'` (`'ucs2'`), `'ascii'`, or `'hex'`. - -The encoding can also be set by specifying an `encoding` field to the -constructor. - -### readable.read([size]) - -* `size` {Number | null} Optional number of bytes to read. -* Return: {Buffer | String | null} - -Note: **This function SHOULD be called by Readable stream users.** - -Call this method to consume data once the `'readable'` event is -emitted. - -The `size` argument will set a minimum number of bytes that you are -interested in. If not set, then the entire content of the internal -buffer is returned. - -If there is no data to consume, or if there are fewer bytes in the -internal buffer than the `size` argument, then `null` is returned, and -a future `'readable'` event will be emitted when more is available. - -Calling `stream.read(0)` will always return `null`, and will trigger a -refresh of the internal buffer, but otherwise be a no-op. - -### readable.pipe(destination, [options]) - -* `destination` {Writable Stream} -* `options` {Object} Optional - * `end` {Boolean} Default=true - -Connects this readable stream to `destination` WriteStream. Incoming -data on this stream gets written to `destination`. Properly manages -back-pressure so that a slow destination will not be overwhelmed by a -fast readable stream. - -This function returns the `destination` stream. - -For example, emulating the Unix `cat` command: - - process.stdin.pipe(process.stdout); - -By default `end()` is called on the destination when the source stream -emits `end`, so that `destination` is no longer writable. Pass `{ end: -false }` as `options` to keep the destination stream open. - -This keeps `writer` open so that "Goodbye" can be written at the -end. - - reader.pipe(writer, { end: false }); - reader.on("end", function() { - writer.end("Goodbye\n"); - }); - -Note that `process.stderr` and `process.stdout` are never closed until -the process exits, regardless of the specified options. - -### readable.unpipe([destination]) - -* `destination` {Writable Stream} Optional - -Undo a previously established `pipe()`. If no destination is -provided, then all previously established pipes are removed. - -### readable.pause() - -Switches the readable stream into "old mode", where data is emitted -using a `'data'` event rather than being buffered for consumption via -the `read()` method. - -Ceases the flow of data. No `'data'` events are emitted while the -stream is in a paused state. - -### readable.resume() - -Switches the readable stream into "old mode", where data is emitted -using a `'data'` event rather than being buffered for consumption via -the `read()` method. - -Resumes the incoming `'data'` events after a `pause()`. - - -## Class: stream.Writable - - - -A `Writable` Stream has the following methods, members, and events. - -Note that `stream.Writable` is an abstract class designed to be -extended with an underlying implementation of the -`_write(chunk, encoding, cb)` method. (See below.) - -### new stream.Writable([options]) - -* `options` {Object} - * `highWaterMark` {Number} Buffer level when `write()` starts - returning false. Default=16kb - * `decodeStrings` {Boolean} Whether or not to decode strings into - Buffers before passing them to `_write()`. Default=true - -In classes that extend the Writable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### writable.\_write(chunk, encoding, callback) - -* `chunk` {Buffer | String} The chunk to be written. Will always - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. Ignore chunk is a buffer. Note that chunk will - **always** be a buffer unless the `decodeStrings` option is - explicitly set to `false`. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -All Writable stream implementations must provide a `_write` method to -send data to the underlying resource. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Writable -class methods only. - -Call the callback using the standard `callback(error)` pattern to -signal that the write completed successfully or with an error. - -If the `decodeStrings` flag is set in the constructor options, then -`chunk` may be a string rather than a Buffer, and `encoding` will -indicate the sort of string that it is. This is to support -implementations that have an optimized handling for certain string -data encodings. If you do not explicitly set the `decodeStrings` -option to `false`, then you can safely ignore the `encoding` argument, -and assume that `chunk` will always be a Buffer. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - - -### writable.write(chunk, [encoding], [callback]) - -* `chunk` {Buffer | String} Data to be written -* `encoding` {String} Optional. If `chunk` is a string, then encoding - defaults to `'utf8'` -* `callback` {Function} Optional. Called when this chunk is - successfully written. -* Returns {Boolean} - -Writes `chunk` to the stream. Returns `true` if the data has been -flushed to the underlying resource. Returns `false` to indicate that -the buffer is full, and the data will be sent out in the future. The -`'drain'` event will indicate when the buffer is empty again. - -The specifics of when `write()` will return false, is determined by -the `highWaterMark` option provided to the constructor. - -### writable.end([chunk], [encoding], [callback]) - -* `chunk` {Buffer | String} Optional final data to be written -* `encoding` {String} Optional. If `chunk` is a string, then encoding - defaults to `'utf8'` -* `callback` {Function} Optional. Called when the final chunk is - successfully written. - -Call this method to signal the end of the data being written to the -stream. - -### Event: 'drain' - -Emitted when the stream's write queue empties and it's safe to write -without buffering again. Listen for it when `stream.write()` returns -`false`. - -### Event: 'close' - -Emitted when the underlying resource (for example, the backing file -descriptor) has been closed. Not all streams will emit this. - -### Event: 'finish' - -When `end()` is called and there are no more chunks to write, this -event is emitted. - -### Event: 'pipe' - -* `source` {Readable Stream} - -Emitted when the stream is passed to a readable stream's pipe method. - -### Event 'unpipe' - -* `source` {Readable Stream} - -Emitted when a previously established `pipe()` is removed using the -source Readable stream's `unpipe()` method. - -## Class: stream.Duplex - - - -A "duplex" stream is one that is both Readable and Writable, such as a -TCP socket connection. - -Note that `stream.Duplex` is an abstract class designed to be -extended with an underlying implementation of the `_read(size)` -and `_write(chunk, encoding, callback)` methods as you would with a Readable or -Writable stream class. - -Since JavaScript doesn't have multiple prototypal inheritance, this -class prototypally inherits from Readable, and then parasitically from -Writable. It is thus up to the user to implement both the lowlevel -`_read(n)` method as well as the lowlevel `_write(chunk, encoding, cb)` method -on extension duplex classes. - -### new stream.Duplex(options) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `allowHalfOpen` {Boolean} Default=true. If set to `false`, then - the stream will automatically end the readable side when the - writable side ends and vice versa. - -In classes that extend the Duplex class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -## Class: stream.Transform - -A "transform" stream is a duplex stream where the output is causally -connected in some way to the input, such as a zlib stream or a crypto -stream. - -There is no requirement that the output be the same size as the input, -the same number of chunks, or arrive at the same time. For example, a -Hash stream will only ever have a single chunk of output which is -provided when the input is ended. A zlib stream will either produce -much smaller or much larger than its input. - -Rather than implement the `_read()` and `_write()` methods, Transform -classes must implement the `_transform()` method, and may optionally -also implement the `_flush()` method. (See below.) - -### new stream.Transform([options]) - -* `options` {Object} Passed to both Writable and Readable - constructors. - -In classes that extend the Transform class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### transform.\_transform(chunk, encoding, callback) - -* `chunk` {Buffer | String} The chunk to be transformed. Will always - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. (Ignore if `decodeStrings` chunk is a buffer.) -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Transform -class methods only. - -All Transform stream implementations must provide a `_transform` -method to accept input and produce output. - -`_transform` should do whatever has to be done in this specific -Transform class, to handle the bytes being written, and pass them off -to the readable portion of the interface. Do asynchronous I/O, -process things, and so on. - -Call `transform.push(outputChunk)` 0 or more times to generate output -from this input chunk, depending on how much data you want to output -as a result of this chunk. - -Call the callback function only when the current chunk is completely -consumed. Note that there may or may not be output as a result of any -particular input chunk. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -### transform.\_flush(callback) - -* `callback` {Function} Call this function (optionally with an error - argument) when you are done flushing any remaining data. - -Note: **This function MUST NOT be called directly.** It MAY be implemented -by child classes, and if so, will be called by the internal Transform -class methods only. - -In some cases, your transform operation may need to emit a bit more -data at the end of the stream. For example, a `Zlib` compression -stream will store up some internal state so that it can optimally -compress the output. At the end, however, it needs to do the best it -can with what is left, so that the data will be complete. - -In those cases, you can implement a `_flush` method, which will be -called at the very end, after all the written data is consumed, but -before emitting `end` to signal the end of the readable side. Just -like with `_transform`, call `transform.push(chunk)` zero or more -times, as appropriate, and call `callback` when the flush operation is -complete. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -### Example: `SimpleProtocol` parser - -The example above of a simple protocol parser can be implemented much -more simply by using the higher level `Transform` stream class. - -In this example, rather than providing the input as an argument, it -would be piped into the parser, which is a more idiomatic Node stream -approach. - -```javascript -function SimpleProtocol(options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Transform.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype = Object.create( - Transform.prototype, { constructor: { value: SimpleProtocol }}); - -SimpleProtocol.prototype._transform = function(chunk, encoding, done) { - if (!this._inBody) { - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // and let them know that we are done parsing the header. - this.emit('header', this.header); - - // now, because we got some extra data, emit this first. - this.push(b); - } - } else { - // from there on, just provide the data to our consumer as-is. - this.push(b); - } - done(); -}; - -var parser = new SimpleProtocol(); -source.pipe(parser) - -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - - -## Class: stream.PassThrough - -This is a trivial implementation of a `Transform` stream that simply -passes the input bytes across to the output. Its purpose is mainly -for examples and testing, but there are occasionally use cases where -it can come in handy. - - -[EventEmitter]: events.html#events_class_events_eventemitter diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/duplex.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/duplex.js deleted file mode 100644 index ca807af8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/duplex.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_duplex.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS deleted file mode 100644 index 205a4256..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS +++ /dev/null @@ -1,32 +0,0 @@ -var Transform = require('../transform'); -var inherits = require('util').inherits; - -// subclass -function MyStream () { - Transform.call(this, { - lowWaterMark: 0, - encoding: 'utf8' - }); -} -inherits(MyStream, Transform); - -MyStream.prototype._transform = function (chunk, outputFn, callback) { - outputFn(new Buffer(String(chunk).toUpperCase())); - callback(); -}; - -// use it! -var s = new MyStream(); -process.stdin.resume(); -process.stdin.pipe(s).pipe(process.stdout); -if (process.stdin.setRawMode) - process.stdin.setRawMode(true); -process.stdin.on('data', function (c) { - c = c.toString(); - if (c === '\u0003' || c === '\u0004') { - process.stdin.pause(); - s.end(); - } - if (c === '\r') - process.stdout.write('\n'); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/typer-fsr.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/typer-fsr.js deleted file mode 100644 index 7e715844..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/typer-fsr.js +++ /dev/null @@ -1,15 +0,0 @@ -var fs = require('fs'); -var FSReadable = require('../fs.js'); -var rst = new FSReadable(__filename); - -rst.on('end', function() { - process.stdin.pause(); -}); - -process.stdin.setRawMode(true); -process.stdin.on('data', function() { - var c = rst.read(3); - if (!c) return; - process.stdout.write(c); -}); -process.stdin.resume(); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/typer.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/typer.js deleted file mode 100644 index c16eb6fb..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/examples/typer.js +++ /dev/null @@ -1,17 +0,0 @@ -var fs = require('fs'); -var fst = fs.createReadStream(__filename); -var Readable = require('../readable.js'); -var rst = new Readable(); -rst.wrap(fst); - -rst.on('end', function() { - process.stdin.pause(); -}); - -process.stdin.setRawMode(true); -process.stdin.on('data', function() { - var c = rst.read(3); - if (!c) return setTimeout(process.exit, 500) - process.stdout.write(c); -}); -process.stdin.resume(); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/float.patch b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/float.patch deleted file mode 100644 index 0ad71a1f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/float.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js -index c5a741c..a2e0d8e 100644 ---- a/lib/_stream_duplex.js -+++ b/lib/_stream_duplex.js -@@ -26,8 +26,8 @@ - - module.exports = Duplex; - var util = require('util'); --var Readable = require('_stream_readable'); --var Writable = require('_stream_writable'); -+var Readable = require('./_stream_readable'); -+var Writable = require('./_stream_writable'); - - util.inherits(Duplex, Readable); - -diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js -index a5e9864..330c247 100644 ---- a/lib/_stream_passthrough.js -+++ b/lib/_stream_passthrough.js -@@ -25,7 +25,7 @@ - - module.exports = PassThrough; - --var Transform = require('_stream_transform'); -+var Transform = require('./_stream_transform'); - var util = require('util'); - util.inherits(PassThrough, Transform); - -diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js -index 2259d2e..e6681ee 100644 ---- a/lib/_stream_readable.js -+++ b/lib/_stream_readable.js -@@ -23,6 +23,9 @@ module.exports = Readable; - Readable.ReadableState = ReadableState; - - var EE = require('events').EventEmitter; -+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { -+ return emitter.listeners(type).length; -+}; - var Stream = require('stream'); - var util = require('util'); - var StringDecoder; -diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js -index e925b4b..f08b05e 100644 ---- a/lib/_stream_transform.js -+++ b/lib/_stream_transform.js -@@ -64,7 +64,7 @@ - - module.exports = Transform; - --var Duplex = require('_stream_duplex'); -+var Duplex = require('./_stream_duplex'); - var util = require('util'); - util.inherits(Transform, Duplex); - -diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js -index a26f711..56ca47d 100644 ---- a/lib/_stream_writable.js -+++ b/lib/_stream_writable.js -@@ -109,7 +109,7 @@ function WritableState(options, stream) { - function Writable(options) { - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. -- if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) -+ if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex'))) - return new Writable(options); - - this._writableState = new WritableState(options, this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/fs.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/fs.js deleted file mode 100644 index a663af86..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/fs.js +++ /dev/null @@ -1,1705 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// Maintainers, keep in mind that octal literals are not allowed -// in strict mode. Use the decimal value and add a comment with -// the octal value. Example: -// -// var mode = 438; /* mode=0666 */ - -var util = require('util'); -var pathModule = require('path'); - -var binding = process.binding('fs'); -var constants = process.binding('constants'); -var fs = exports; -var Stream = require('stream').Stream; -var EventEmitter = require('events').EventEmitter; - -var Readable = require('./lib/_stream_readable.js'); -var Writable = require('./lib/_stream_writable.js'); - -var kMinPoolSpace = 128; -var kPoolSize = 40 * 1024; - -var O_APPEND = constants.O_APPEND || 0; -var O_CREAT = constants.O_CREAT || 0; -var O_DIRECTORY = constants.O_DIRECTORY || 0; -var O_EXCL = constants.O_EXCL || 0; -var O_NOCTTY = constants.O_NOCTTY || 0; -var O_NOFOLLOW = constants.O_NOFOLLOW || 0; -var O_RDONLY = constants.O_RDONLY || 0; -var O_RDWR = constants.O_RDWR || 0; -var O_SYMLINK = constants.O_SYMLINK || 0; -var O_SYNC = constants.O_SYNC || 0; -var O_TRUNC = constants.O_TRUNC || 0; -var O_WRONLY = constants.O_WRONLY || 0; - -var isWindows = process.platform === 'win32'; - -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - if (DEBUG) { - var backtrace = new Error; - return function(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - throw err; - } - }; - } - - return function(err) { - if (err) { - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - } - }; -} - -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); -} - -// Ensure that callbacks run in the global context. Only use this function -// for callbacks that are passed to the binding layer, callbacks that are -// invoked from JS already run in the proper scope. -function makeCallback(cb) { - if (typeof cb !== 'function') { - return rethrow(); - } - - return function() { - return cb.apply(null, arguments); - }; -} - -function assertEncoding(encoding) { - if (encoding && !Buffer.isEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -function nullCheck(path, callback) { - if (('' + path).indexOf('\u0000') !== -1) { - var er = new Error('Path must be a string without null bytes.'); - if (!callback) - throw er; - process.nextTick(function() { - callback(er); - }); - return false; - } - return true; -} - -fs.Stats = binding.Stats; - -fs.Stats.prototype._checkModeProperty = function(property) { - return ((this.mode & constants.S_IFMT) === property); -}; - -fs.Stats.prototype.isDirectory = function() { - return this._checkModeProperty(constants.S_IFDIR); -}; - -fs.Stats.prototype.isFile = function() { - return this._checkModeProperty(constants.S_IFREG); -}; - -fs.Stats.prototype.isBlockDevice = function() { - return this._checkModeProperty(constants.S_IFBLK); -}; - -fs.Stats.prototype.isCharacterDevice = function() { - return this._checkModeProperty(constants.S_IFCHR); -}; - -fs.Stats.prototype.isSymbolicLink = function() { - return this._checkModeProperty(constants.S_IFLNK); -}; - -fs.Stats.prototype.isFIFO = function() { - return this._checkModeProperty(constants.S_IFIFO); -}; - -fs.Stats.prototype.isSocket = function() { - return this._checkModeProperty(constants.S_IFSOCK); -}; - -fs.exists = function(path, callback) { - if (!nullCheck(path, cb)) return; - binding.stat(pathModule._makeLong(path), cb); - function cb(err, stats) { - if (callback) callback(err ? false : true); - } -}; - -fs.existsSync = function(path) { - try { - nullCheck(path); - binding.stat(pathModule._makeLong(path)); - return true; - } catch (e) { - return false; - } -}; - -fs.readFile = function(path, encoding_) { - var encoding = typeof(encoding_) === 'string' ? encoding_ : null; - var callback = maybeCallback(arguments[arguments.length - 1]); - - assertEncoding(encoding); - - // first, stat the file, so we know the size. - var size; - var buffer; // single buffer with file data - var buffers; // list for when size is unknown - var pos = 0; - var fd; - - fs.open(path, constants.O_RDONLY, 438 /*=0666*/, function(er, fd_) { - if (er) return callback(er); - fd = fd_; - - fs.fstat(fd, function(er, st) { - if (er) return callback(er); - size = st.size; - if (size === 0) { - // the kernel lies about many files. - // Go ahead and try to read some bytes. - buffers = []; - return read(); - } - - buffer = new Buffer(size); - read(); - }); - }); - - function read() { - if (size === 0) { - buffer = new Buffer(8192); - fs.read(fd, buffer, 0, 8192, -1, afterRead); - } else { - fs.read(fd, buffer, pos, size - pos, -1, afterRead); - } - } - - function afterRead(er, bytesRead) { - if (er) { - return fs.close(fd, function(er2) { - return callback(er); - }); - } - - if (bytesRead === 0) { - return close(); - } - - pos += bytesRead; - if (size !== 0) { - if (pos === size) close(); - else read(); - } else { - // unknown size, just read until we don't get bytes. - buffers.push(buffer.slice(0, bytesRead)); - read(); - } - } - - function close() { - fs.close(fd, function(er) { - if (size === 0) { - // collected the data into the buffers list. - buffer = Buffer.concat(buffers, pos); - } else if (pos < size) { - buffer = buffer.slice(0, pos); - } - - if (encoding) buffer = buffer.toString(encoding); - return callback(er, buffer); - }); - } -}; - -fs.readFileSync = function(path, encoding) { - assertEncoding(encoding); - - var fd = fs.openSync(path, constants.O_RDONLY, 438 /*=0666*/); - - var size; - var threw = true; - try { - size = fs.fstatSync(fd).size; - threw = false; - } finally { - if (threw) fs.closeSync(fd); - } - - var pos = 0; - var buffer; // single buffer with file data - var buffers; // list for when size is unknown - - if (size === 0) { - buffers = []; - } else { - buffer = new Buffer(size); - } - - var done = false; - while (!done) { - var threw = true; - try { - if (size !== 0) { - var bytesRead = fs.readSync(fd, buffer, pos, size - pos); - } else { - // the kernel lies about many files. - // Go ahead and try to read some bytes. - buffer = new Buffer(8192); - var bytesRead = fs.readSync(fd, buffer, 0, 8192); - if (bytesRead) { - buffers.push(buffer.slice(0, bytesRead)); - } - } - threw = false; - } finally { - if (threw) fs.closeSync(fd); - } - - pos += bytesRead; - done = (bytesRead === 0) || (size !== 0 && pos >= size); - } - - fs.closeSync(fd); - - if (size === 0) { - // data was collected into the buffers list. - buffer = Buffer.concat(buffers, pos); - } else if (pos < size) { - buffer = buffer.slice(0, pos); - } - - if (encoding) buffer = buffer.toString(encoding); - return buffer; -}; - - -// Used by binding.open and friends -function stringToFlags(flag) { - // Only mess with strings - if (typeof flag !== 'string') { - return flag; - } - - // O_EXCL is mandated by POSIX, Windows supports it too. - // Let's add a check anyway, just in case. - if (!O_EXCL && ~flag.indexOf('x')) { - throw errnoException('ENOSYS', 'fs.open(O_EXCL)'); - } - - switch (flag) { - case 'r' : return O_RDONLY; - case 'rs' : return O_RDONLY | O_SYNC; - case 'r+' : return O_RDWR; - case 'rs+' : return O_RDWR | O_SYNC; - - case 'w' : return O_TRUNC | O_CREAT | O_WRONLY; - case 'wx' : // fall through - case 'xw' : return O_TRUNC | O_CREAT | O_WRONLY | O_EXCL; - - case 'w+' : return O_TRUNC | O_CREAT | O_RDWR; - case 'wx+': // fall through - case 'xw+': return O_TRUNC | O_CREAT | O_RDWR | O_EXCL; - - case 'a' : return O_APPEND | O_CREAT | O_WRONLY; - case 'ax' : // fall through - case 'xa' : return O_APPEND | O_CREAT | O_WRONLY | O_EXCL; - - case 'a+' : return O_APPEND | O_CREAT | O_RDWR; - case 'ax+': // fall through - case 'xa+': return O_APPEND | O_CREAT | O_RDWR | O_EXCL; - } - - throw new Error('Unknown file open flag: ' + flag); -} - -// exported but hidden, only used by test/simple/test-fs-open-flags.js -Object.defineProperty(exports, '_stringToFlags', { - enumerable: false, - value: stringToFlags -}); - - -// Yes, the follow could be easily DRYed up but I provide the explicit -// list to make the arguments clear. - -fs.close = function(fd, callback) { - binding.close(fd, makeCallback(callback)); -}; - -fs.closeSync = function(fd) { - return binding.close(fd); -}; - -function modeNum(m, def) { - switch (typeof m) { - case 'number': return m; - case 'string': return parseInt(m, 8); - default: - if (def) { - return modeNum(def); - } else { - return undefined; - } - } -} - -fs.open = function(path, flags, mode, callback) { - callback = makeCallback(arguments[arguments.length - 1]); - mode = modeNum(mode, 438 /*=0666*/); - - if (!nullCheck(path, callback)) return; - binding.open(pathModule._makeLong(path), - stringToFlags(flags), - mode, - callback); -}; - -fs.openSync = function(path, flags, mode) { - mode = modeNum(mode, 438 /*=0666*/); - nullCheck(path); - return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); -}; - -fs.read = function(fd, buffer, offset, length, position, callback) { - if (!Buffer.isBuffer(buffer)) { - // legacy string interface (fd, length, position, encoding, callback) - var cb = arguments[4], - encoding = arguments[3]; - - assertEncoding(encoding); - - position = arguments[2]; - length = arguments[1]; - buffer = new Buffer(length); - offset = 0; - - callback = function(err, bytesRead) { - if (!cb) return; - - var str = (bytesRead > 0) ? buffer.toString(encoding, 0, bytesRead) : ''; - - (cb)(err, str, bytesRead); - }; - } - - function wrapper(err, bytesRead) { - // Retain a reference to buffer so that it can't be GC'ed too soon. - callback && callback(err, bytesRead || 0, buffer); - } - - binding.read(fd, buffer, offset, length, position, wrapper); -}; - -fs.readSync = function(fd, buffer, offset, length, position) { - var legacy = false; - if (!Buffer.isBuffer(buffer)) { - // legacy string interface (fd, length, position, encoding, callback) - legacy = true; - var encoding = arguments[3]; - - assertEncoding(encoding); - - position = arguments[2]; - length = arguments[1]; - buffer = new Buffer(length); - - offset = 0; - } - - var r = binding.read(fd, buffer, offset, length, position); - if (!legacy) { - return r; - } - - var str = (r > 0) ? buffer.toString(encoding, 0, r) : ''; - return [str, r]; -}; - -fs.write = function(fd, buffer, offset, length, position, callback) { - if (!Buffer.isBuffer(buffer)) { - // legacy string interface (fd, data, position, encoding, callback) - callback = arguments[4]; - position = arguments[2]; - assertEncoding(arguments[3]); - - buffer = new Buffer('' + arguments[1], arguments[3]); - offset = 0; - length = buffer.length; - } - - if (!length) { - if (typeof callback == 'function') { - process.nextTick(function() { - callback(undefined, 0); - }); - } - return; - } - - callback = maybeCallback(callback); - - function wrapper(err, written) { - // Retain a reference to buffer so that it can't be GC'ed too soon. - callback(err, written || 0, buffer); - } - - binding.write(fd, buffer, offset, length, position, wrapper); -}; - -fs.writeSync = function(fd, buffer, offset, length, position) { - if (!Buffer.isBuffer(buffer)) { - // legacy string interface (fd, data, position, encoding) - position = arguments[2]; - assertEncoding(arguments[3]); - - buffer = new Buffer('' + arguments[1], arguments[3]); - offset = 0; - length = buffer.length; - } - if (!length) return 0; - - return binding.write(fd, buffer, offset, length, position); -}; - -fs.rename = function(oldPath, newPath, callback) { - callback = makeCallback(callback); - if (!nullCheck(oldPath, callback)) return; - if (!nullCheck(newPath, callback)) return; - binding.rename(pathModule._makeLong(oldPath), - pathModule._makeLong(newPath), - callback); -}; - -fs.renameSync = function(oldPath, newPath) { - nullCheck(oldPath); - nullCheck(newPath); - return binding.rename(pathModule._makeLong(oldPath), - pathModule._makeLong(newPath)); -}; - -fs.truncate = function(path, len, callback) { - if (typeof path === 'number') { - // legacy - return fs.ftruncate(path, len, callback); - } - if (typeof len === 'function') { - callback = len; - len = 0; - } else if (typeof len === 'undefined') { - len = 0; - } - callback = maybeCallback(callback); - fs.open(path, 'w', function(er, fd) { - if (er) return callback(er); - binding.ftruncate(fd, len, function(er) { - fs.close(fd, function(er2) { - callback(er || er2); - }); - }); - }); -}; - -fs.truncateSync = function(path, len) { - if (typeof path === 'number') { - // legacy - return fs.ftruncateSync(path, len); - } - if (typeof len === 'undefined') { - len = 0; - } - // allow error to be thrown, but still close fd. - var fd = fs.openSync(path, 'w'); - try { - var ret = fs.ftruncateSync(fd, len); - } finally { - fs.closeSync(fd); - } - return ret; -}; - -fs.ftruncate = function(fd, len, callback) { - if (typeof len === 'function') { - callback = len; - len = 0; - } else if (typeof len === 'undefined') { - len = 0; - } - binding.ftruncate(fd, len, makeCallback(callback)); -}; - -fs.ftruncateSync = function(fd, len) { - if (typeof len === 'undefined') { - len = 0; - } - return binding.ftruncate(fd, len); -}; - -fs.rmdir = function(path, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.rmdir(pathModule._makeLong(path), callback); -}; - -fs.rmdirSync = function(path) { - nullCheck(path); - return binding.rmdir(pathModule._makeLong(path)); -}; - -fs.fdatasync = function(fd, callback) { - binding.fdatasync(fd, makeCallback(callback)); -}; - -fs.fdatasyncSync = function(fd) { - return binding.fdatasync(fd); -}; - -fs.fsync = function(fd, callback) { - binding.fsync(fd, makeCallback(callback)); -}; - -fs.fsyncSync = function(fd) { - return binding.fsync(fd); -}; - -fs.mkdir = function(path, mode, callback) { - if (typeof mode === 'function') callback = mode; - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.mkdir(pathModule._makeLong(path), - modeNum(mode, 511 /*=0777*/), - callback); -}; - -fs.mkdirSync = function(path, mode) { - nullCheck(path); - return binding.mkdir(pathModule._makeLong(path), - modeNum(mode, 511 /*=0777*/)); -}; - -fs.sendfile = function(outFd, inFd, inOffset, length, callback) { - binding.sendfile(outFd, inFd, inOffset, length, makeCallback(callback)); -}; - -fs.sendfileSync = function(outFd, inFd, inOffset, length) { - return binding.sendfile(outFd, inFd, inOffset, length); -}; - -fs.readdir = function(path, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.readdir(pathModule._makeLong(path), callback); -}; - -fs.readdirSync = function(path) { - nullCheck(path); - return binding.readdir(pathModule._makeLong(path)); -}; - -fs.fstat = function(fd, callback) { - binding.fstat(fd, makeCallback(callback)); -}; - -fs.lstat = function(path, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.lstat(pathModule._makeLong(path), callback); -}; - -fs.stat = function(path, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.stat(pathModule._makeLong(path), callback); -}; - -fs.fstatSync = function(fd) { - return binding.fstat(fd); -}; - -fs.lstatSync = function(path) { - nullCheck(path); - return binding.lstat(pathModule._makeLong(path)); -}; - -fs.statSync = function(path) { - nullCheck(path); - return binding.stat(pathModule._makeLong(path)); -}; - -fs.readlink = function(path, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.readlink(pathModule._makeLong(path), callback); -}; - -fs.readlinkSync = function(path) { - nullCheck(path); - return binding.readlink(pathModule._makeLong(path)); -}; - -function preprocessSymlinkDestination(path, type) { - if (!isWindows) { - // No preprocessing is needed on Unix. - return path; - } else if (type === 'junction') { - // Junctions paths need to be absolute and \\?\-prefixed. - return pathModule._makeLong(path); - } else { - // Windows symlinks don't tolerate forward slashes. - return ('' + path).replace(/\//g, '\\'); - } -} - -fs.symlink = function(destination, path, type_, callback) { - var type = (typeof type_ === 'string' ? type_ : null); - var callback = makeCallback(arguments[arguments.length - 1]); - - if (!nullCheck(destination, callback)) return; - if (!nullCheck(path, callback)) return; - - binding.symlink(preprocessSymlinkDestination(destination, type), - pathModule._makeLong(path), - type, - callback); -}; - -fs.symlinkSync = function(destination, path, type) { - type = (typeof type === 'string' ? type : null); - - nullCheck(destination); - nullCheck(path); - - return binding.symlink(preprocessSymlinkDestination(destination, type), - pathModule._makeLong(path), - type); -}; - -fs.link = function(srcpath, dstpath, callback) { - callback = makeCallback(callback); - if (!nullCheck(srcpath, callback)) return; - if (!nullCheck(dstpath, callback)) return; - - binding.link(pathModule._makeLong(srcpath), - pathModule._makeLong(dstpath), - callback); -}; - -fs.linkSync = function(srcpath, dstpath) { - nullCheck(srcpath); - nullCheck(dstpath); - return binding.link(pathModule._makeLong(srcpath), - pathModule._makeLong(dstpath)); -}; - -fs.unlink = function(path, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.unlink(pathModule._makeLong(path), callback); -}; - -fs.unlinkSync = function(path) { - nullCheck(path); - return binding.unlink(pathModule._makeLong(path)); -}; - -fs.fchmod = function(fd, mode, callback) { - binding.fchmod(fd, modeNum(mode), makeCallback(callback)); -}; - -fs.fchmodSync = function(fd, mode) { - return binding.fchmod(fd, modeNum(mode)); -}; - -if (constants.hasOwnProperty('O_SYMLINK')) { - fs.lchmod = function(path, mode, callback) { - callback = maybeCallback(callback); - fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) { - if (err) { - callback(err); - return; - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function(err) { - fs.close(fd, function(err2) { - callback(err || err2); - }); - }); - }); - }; - - fs.lchmodSync = function(path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK); - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var err, err2; - try { - var ret = fs.fchmodSync(fd, mode); - } catch (er) { - err = er; - } - try { - fs.closeSync(fd); - } catch (er) { - err2 = er; - } - if (err || err2) throw (err || err2); - return ret; - }; -} - - -fs.chmod = function(path, mode, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.chmod(pathModule._makeLong(path), - modeNum(mode), - callback); -}; - -fs.chmodSync = function(path, mode) { - nullCheck(path); - return binding.chmod(pathModule._makeLong(path), modeNum(mode)); -}; - -if (constants.hasOwnProperty('O_SYMLINK')) { - fs.lchown = function(path, uid, gid, callback) { - callback = maybeCallback(callback); - fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) { - if (err) { - callback(err); - return; - } - fs.fchown(fd, uid, gid, callback); - }); - }; - - fs.lchownSync = function(path, uid, gid) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK); - return fs.fchownSync(fd, uid, gid); - }; -} - -fs.fchown = function(fd, uid, gid, callback) { - binding.fchown(fd, uid, gid, makeCallback(callback)); -}; - -fs.fchownSync = function(fd, uid, gid) { - return binding.fchown(fd, uid, gid); -}; - -fs.chown = function(path, uid, gid, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.chown(pathModule._makeLong(path), uid, gid, callback); -}; - -fs.chownSync = function(path, uid, gid) { - nullCheck(path); - return binding.chown(pathModule._makeLong(path), uid, gid); -}; - -// converts Date or number to a fractional UNIX timestamp -function toUnixTimestamp(time) { - if (typeof time == 'number') { - return time; - } - if (time instanceof Date) { - // convert to 123.456 UNIX timestamp - return time.getTime() / 1000; - } - throw new Error('Cannot parse time: ' + time); -} - -// exported for unit tests, not for public consumption -fs._toUnixTimestamp = toUnixTimestamp; - -fs.utimes = function(path, atime, mtime, callback) { - callback = makeCallback(callback); - if (!nullCheck(path, callback)) return; - binding.utimes(pathModule._makeLong(path), - toUnixTimestamp(atime), - toUnixTimestamp(mtime), - callback); -}; - -fs.utimesSync = function(path, atime, mtime) { - nullCheck(path); - atime = toUnixTimestamp(atime); - mtime = toUnixTimestamp(mtime); - binding.utimes(pathModule._makeLong(path), atime, mtime); -}; - -fs.futimes = function(fd, atime, mtime, callback) { - atime = toUnixTimestamp(atime); - mtime = toUnixTimestamp(mtime); - binding.futimes(fd, atime, mtime, makeCallback(callback)); -}; - -fs.futimesSync = function(fd, atime, mtime) { - atime = toUnixTimestamp(atime); - mtime = toUnixTimestamp(mtime); - binding.futimes(fd, atime, mtime); -}; - -function writeAll(fd, buffer, offset, length, position, callback) { - callback = maybeCallback(arguments[arguments.length - 1]); - - // write(fd, buffer, offset, length, position, callback) - fs.write(fd, buffer, offset, length, position, function(writeErr, written) { - if (writeErr) { - fs.close(fd, function() { - if (callback) callback(writeErr); - }); - } else { - if (written === length) { - fs.close(fd, callback); - } else { - offset += written; - length -= written; - position += written; - writeAll(fd, buffer, offset, length, position, callback); - } - } - }); -} - -fs.writeFile = function(path, data, encoding_, callback) { - var encoding = (typeof(encoding_) == 'string' ? encoding_ : 'utf8'); - assertEncoding(encoding); - - callback = maybeCallback(arguments[arguments.length - 1]); - fs.open(path, 'w', 438 /*=0666*/, function(openErr, fd) { - if (openErr) { - if (callback) callback(openErr); - } else { - var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data, - encoding); - writeAll(fd, buffer, 0, buffer.length, 0, callback); - } - }); -}; - -fs.writeFileSync = function(path, data, encoding) { - assertEncoding(encoding); - - var fd = fs.openSync(path, 'w'); - if (!Buffer.isBuffer(data)) { - data = new Buffer('' + data, encoding || 'utf8'); - } - var written = 0; - var length = data.length; - try { - while (written < length) { - written += fs.writeSync(fd, data, written, length - written, written); - } - } finally { - fs.closeSync(fd); - } -}; - -fs.appendFile = function(path, data, encoding_, callback) { - var encoding = (typeof(encoding_) == 'string' ? encoding_ : 'utf8'); - assertEncoding(encoding); - - callback = maybeCallback(arguments[arguments.length - 1]); - - fs.open(path, 'a', 438 /*=0666*/, function(err, fd) { - if (err) return callback(err); - var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data, encoding); - writeAll(fd, buffer, 0, buffer.length, null, callback); - }); -}; - -fs.appendFileSync = function(path, data, encoding) { - assertEncoding(encoding); - - var fd = fs.openSync(path, 'a'); - if (!Buffer.isBuffer(data)) { - data = new Buffer('' + data, encoding || 'utf8'); - } - var written = 0; - var position = null; - var length = data.length; - - try { - while (written < length) { - written += fs.writeSync(fd, data, written, length - written, position); - position += written; // XXX not safe with multiple concurrent writers? - } - } finally { - fs.closeSync(fd); - } -}; - -function errnoException(errorno, syscall) { - // TODO make this more compatible with ErrnoException from src/node.cc - // Once all of Node is using this function the ErrnoException from - // src/node.cc should be removed. - var e = new Error(syscall + ' ' + errorno); - e.errno = e.code = errorno; - e.syscall = syscall; - return e; -} - - -function FSWatcher() { - EventEmitter.call(this); - - var self = this; - var FSEvent = process.binding('fs_event_wrap').FSEvent; - this._handle = new FSEvent(); - this._handle.owner = this; - - this._handle.onchange = function(status, event, filename) { - if (status) { - self._handle.close(); - self.emit('error', errnoException(errno, 'watch')); - } else { - self.emit('change', event, filename); - } - }; -} -util.inherits(FSWatcher, EventEmitter); - -FSWatcher.prototype.start = function(filename, persistent) { - nullCheck(filename); - var r = this._handle.start(pathModule._makeLong(filename), persistent); - - if (r) { - this._handle.close(); - throw errnoException(errno, 'watch'); - } -}; - -FSWatcher.prototype.close = function() { - this._handle.close(); -}; - -fs.watch = function(filename) { - nullCheck(filename); - var watcher; - var options; - var listener; - - if ('object' == typeof arguments[1]) { - options = arguments[1]; - listener = arguments[2]; - } else { - options = {}; - listener = arguments[1]; - } - - if (options.persistent === undefined) options.persistent = true; - - watcher = new FSWatcher(); - watcher.start(filename, options.persistent); - - if (listener) { - watcher.addListener('change', listener); - } - - return watcher; -}; - - -// Stat Change Watchers - -function StatWatcher() { - EventEmitter.call(this); - - var self = this; - this._handle = new binding.StatWatcher(); - - // uv_fs_poll is a little more powerful than ev_stat but we curb it for - // the sake of backwards compatibility - var oldStatus = -1; - - this._handle.onchange = function(current, previous, newStatus) { - if (oldStatus === -1 && - newStatus === -1 && - current.nlink === previous.nlink) return; - - oldStatus = newStatus; - self.emit('change', current, previous); - }; - - this._handle.onstop = function() { - self.emit('stop'); - }; -} -util.inherits(StatWatcher, EventEmitter); - - -StatWatcher.prototype.start = function(filename, persistent, interval) { - nullCheck(filename); - this._handle.start(pathModule._makeLong(filename), persistent, interval); -}; - - -StatWatcher.prototype.stop = function() { - this._handle.stop(); -}; - - -var statWatchers = {}; -function inStatWatchers(filename) { - return Object.prototype.hasOwnProperty.call(statWatchers, filename) && - statWatchers[filename]; -} - - -fs.watchFile = function(filename) { - nullCheck(filename); - var stat; - var listener; - - var options = { - // Poll interval in milliseconds. 5007 is what libev used to use. It's - // a little on the slow side but let's stick with it for now to keep - // behavioral changes to a minimum. - interval: 5007, - persistent: true - }; - - if ('object' == typeof arguments[1]) { - options = util._extend(options, arguments[1]); - listener = arguments[2]; - } else { - listener = arguments[1]; - } - - if (!listener) { - throw new Error('watchFile requires a listener function'); - } - - if (inStatWatchers(filename)) { - stat = statWatchers[filename]; - } else { - stat = statWatchers[filename] = new StatWatcher(); - stat.start(filename, options.persistent, options.interval); - } - stat.addListener('change', listener); - return stat; -}; - -fs.unwatchFile = function(filename, listener) { - nullCheck(filename); - if (!inStatWatchers(filename)) return; - - var stat = statWatchers[filename]; - - if (typeof listener === 'function') { - stat.removeListener('change', listener); - } else { - stat.removeAllListeners('change'); - } - - if (stat.listeners('change').length === 0) { - stat.stop(); - statWatchers[filename] = undefined; - } -}; - -// Realpath -// Not using realpath(2) because it's bad. -// See: http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html - -var normalize = pathModule.normalize; - -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} - -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; -} - -fs.realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } - - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } - - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; - } - } - if (linkTarget === null) { - fs.statSync(base); - linkTarget = fs.readlinkSync(base); - } - resolvedLink = pathModule.resolve(previous, linkTarget); - // track this, if given a cache. - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; - } - - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } - - if (cache) cache[original] = p; - - return p; -}; - - -fs.realpath = function realpath(p, cache, cb) { - if (typeof cb !== 'function') { - cb = maybeCallback(cache); - cache = null; - } - - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { - if (err) return cb(err); - knownHard[base] = true; - LOOP(); - }); - } else { - process.nextTick(LOOP); - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - function LOOP() { - // stop if scanned past end of path - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); - } - - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - return process.nextTick(LOOP); - } - - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // known symbolic link. no need to stat again. - return gotResolvedLink(cache[base]); - } - - return fs.lstat(base, gotStat); - } - - function gotStat(err, stat) { - if (err) return cb(err); - - // if not a symlink, skip to the next path part - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - return process.nextTick(LOOP); - } - - // stat & read the link if not read before - // call gotTarget as soon as the link target is known - // dev/ino always return 0 on windows, so skip the check. - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - return gotTarget(null, seenLinks[id], base); - } - } - fs.stat(base, function(err) { - if (err) return cb(err); - - fs.readlink(base, function(err, target) { - if (!isWindows) seenLinks[id] = target; - gotTarget(err, target); - }); - }); - } - - function gotTarget(err, target, base) { - if (err) return cb(err); - - var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base] = resolvedLink; - gotResolvedLink(resolvedLink); - } - - function gotResolvedLink(resolvedLink) { - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } -}; - - - -var pool; - -function allocNewPool() { - pool = new Buffer(kPoolSize); - pool.used = 0; -} - - - -fs.createReadStream = function(path, options) { - return new ReadStream(path, options); -}; - -util.inherits(ReadStream, Readable); -fs.ReadStream = ReadStream; - -function ReadStream(path, options) { - if (!(this instanceof ReadStream)) - return new ReadStream(path, options); - - // a little bit bigger buffer and water marks by default - options = util._extend({ - bufferSize: 64 * 1024, - lowWaterMark: 16 * 1024, - highWaterMark: 64 * 1024 - }, options || {}); - - Readable.call(this, options); - - this.path = path; - this.fd = options.hasOwnProperty('fd') ? options.fd : null; - this.flags = options.hasOwnProperty('flags') ? options.flags : 'r'; - this.mode = options.hasOwnProperty('mode') ? options.mode : 438; /*=0666*/ - - this.start = options.hasOwnProperty('start') ? options.start : undefined; - this.end = options.hasOwnProperty('start') ? options.end : undefined; - this.pos = undefined; - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (typeof this.fd !== 'number') - this.open(); - - this.on('end', function() { - this.destroy(); - }); -} - -fs.FileReadStream = fs.ReadStream; // support the legacy name - -ReadStream.prototype.open = function() { - var self = this; - fs.open(this.path, this.flags, this.mode, function(er, fd) { - if (er) { - self.destroy(); - self.emit('error', er); - return; - } - - self.fd = fd; - self.emit('open', fd); - // start the flow of data. - self.read(); - }); -}; - -ReadStream.prototype._read = function(n, cb) { - if (typeof this.fd !== 'number') - return this.once('open', function() { - this._read(n, cb); - }); - - if (this.destroyed) - return; - - if (!pool || pool.length - pool.used < kMinPoolSpace) { - // discard the old pool. Can't add to the free list because - // users might have refernces to slices on it. - pool = null; - allocNewPool(); - } - - // Grab another reference to the pool in the case that while we're - // in the thread pool another read() finishes up the pool, and - // allocates a new one. - var thisPool = pool; - var toRead = Math.min(pool.length - pool.used, n); - var start = pool.used; - - if (this.pos !== undefined) - toRead = Math.min(this.end - this.pos + 1, toRead); - - // already read everything we were supposed to read! - // treat as EOF. - if (toRead <= 0) - return cb(); - - // the actual read. - var self = this; - fs.read(this.fd, pool, pool.used, toRead, this.pos, onread); - - // move the pool positions, and internal position for reading. - if (this.pos !== undefined) - this.pos += toRead; - pool.used += toRead; - - function onread(er, bytesRead) { - if (er) { - self.destroy(); - return cb(er); - } - - var b = null; - if (bytesRead > 0) - b = thisPool.slice(start, start + bytesRead); - - cb(null, b); - } -}; - - -ReadStream.prototype.destroy = function() { - if (this.destroyed) - return; - this.destroyed = true; - if ('number' === typeof this.fd) - this.close(); -}; - - -ReadStream.prototype.close = function(cb) { - if (cb) - this.once('close', cb); - if (this.closed || 'number' !== typeof this.fd) { - if ('number' !== typeof this.fd) - this.once('open', close); - return process.nextTick(this.emit.bind(this, 'close')); - } - this.closed = true; - var self = this; - close(); - - function close() { - fs.close(self.fd, function(er) { - if (er) - self.emit('error', er); - else - self.emit('close'); - }); - } -}; - - - - -fs.createWriteStream = function(path, options) { - return new WriteStream(path, options); -}; - -util.inherits(WriteStream, Writable); -fs.WriteStream = WriteStream; -function WriteStream(path, options) { - if (!(this instanceof WriteStream)) - return new WriteStream(path, options); - - // a little bit bigger buffer and water marks by default - options = util._extend({ - bufferSize: 64 * 1024, - lowWaterMark: 16 * 1024, - highWaterMark: 64 * 1024 - }, options || {}); - - Writable.call(this, options); - - this.path = path; - this.fd = null; - - this.fd = options.hasOwnProperty('fd') ? options.fd : null; - this.flags = options.hasOwnProperty('flags') ? options.flags : 'w'; - this.mode = options.hasOwnProperty('mode') ? options.mode : 438; /*=0666*/ - - this.start = options.hasOwnProperty('start') ? options.start : undefined; - this.pos = undefined; - this.bytesWritten = 0; - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - if ('number' !== typeof this.fd) - this.open(); - - // dispose on finish. - this.once('finish', this.close); -} - -fs.FileWriteStream = fs.WriteStream; // support the legacy name - - -WriteStream.prototype.open = function() { - fs.open(this.path, this.flags, this.mode, function(er, fd) { - if (er) { - this.destroy(); - this.emit('error', er); - return; - } - - this.fd = fd; - this.emit('open', fd); - }.bind(this)); -}; - - -WriteStream.prototype._write = function(data, cb) { - if (!Buffer.isBuffer(data)) - return this.emit('error', new Error('Invalid data')); - - if (typeof this.fd !== 'number') - return this.once('open', this._write.bind(this, data, cb)); - - fs.write(this.fd, data, 0, data.length, this.pos, function(er, bytes) { - if (er) { - this.destroy(); - return cb(er); - } - this.bytesWritten += bytes; - cb(); - }.bind(this)); - - if (this.pos !== undefined) - this.pos += data.length; -}; - - -WriteStream.prototype.destroy = ReadStream.prototype.destroy; -WriteStream.prototype.close = ReadStream.prototype.close; - -// There is no shutdown() for files. -WriteStream.prototype.destroySoon = WriteStream.prototype.end; - - -// SyncWriteStream is internal. DO NOT USE. -// Temporary hack for process.stdout and process.stderr when piped to files. -function SyncWriteStream(fd) { - Stream.call(this); - - this.fd = fd; - this.writable = true; - this.readable = false; -} - -util.inherits(SyncWriteStream, Stream); - - -// Export -fs.SyncWriteStream = SyncWriteStream; - - -SyncWriteStream.prototype.write = function(data, arg1, arg2) { - var encoding, cb; - - // parse arguments - if (arg1) { - if (typeof arg1 === 'string') { - encoding = arg1; - cb = arg2; - } else if (typeof arg1 === 'function') { - cb = arg1; - } else { - throw new Error('bad arg'); - } - } - assertEncoding(encoding); - - // Change strings to buffers. SLOW - if (typeof data == 'string') { - data = new Buffer(data, encoding); - } - - fs.writeSync(this.fd, data, 0, data.length); - - if (cb) { - process.nextTick(cb); - } - - return true; -}; - - -SyncWriteStream.prototype.end = function(data, arg1, arg2) { - if (data) { - this.write(data, arg1, arg2); - } - this.destroy(); -}; - - -SyncWriteStream.prototype.destroy = function() { - fs.closeSync(this.fd); - this.fd = null; - this.emit('close'); - return true; -}; - -SyncWriteStream.prototype.destroySoon = SyncWriteStream.prototype.destroy; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index a2e0d8e0..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -module.exports = Duplex; -var util = require('util'); -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -Object.keys(Writable.prototype).forEach(function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; -}); - -function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index 3c9da084..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,927 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -module.exports = Readable; -Readable.ReadableState = ReadableState; - -var EE = require('events').EventEmitter; -if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; -}; -var Stream = require('stream'); -var util = require('util'); -var StringDecoder; - -util.inherits(Readable, Stream); - -function ReadableState(options, stream) { - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = false; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // In streams that never have any data, and do push(null) right away, - // the consumer can miss the 'end' event if they do some I/O before - // consuming the stream. So, we don't emit('end') until some reading - // happens. - this.calledRead = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (typeof chunk === 'string' && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null || chunk === undefined) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) { - state.buffer.unshift(chunk); - } else { - state.reading = false; - state.buffer.push(chunk); - } - - if (state.needReadable) - emitReadable(stream); - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - - - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; -}; - -// Don't raise the hwm > 128MB -var MAX_HWM = 0x800000; -function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (isNaN(n) || n === null) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { - var state = this._readableState; - state.calledRead = true; - var nOrig = n; - - if (typeof n !== 'number' || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - - // if we currently have less than the highWaterMark, then also read some - if (state.length - n <= state.highWaterMark) - doRead = true; - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) - doRead = false; - - if (doRead) { - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read called its callback synchronously, then `reading` - // will be false, and we need to re-evaluate how much data we - // can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we happened to read() exactly the remaining amount in the - // buffer, and the EOF has been seen at this point, then make sure - // that we emit 'end' on the very next tick. - if (state.ended && !state.endEmitted && state.length === 0) - endReadable(this); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && - !state.objectMode && - !er) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - - -function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // if we've ended and we have some data left, then emit - // 'readable' now to make sure it gets picked up. - if (state.length > 0) - emitReadable(stream); - else - endReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (state.emittedReadable) - return; - - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); -} - -function emitReadable_(stream) { - stream.emit('readable'); -} - - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - if (readable !== src) return; - cleanup(); - } - - function onend() { - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (!dest._writableState || dest._writableState.needDrain) - ondrain(); - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events.error) - dest.on('error', onerror); - else if (Array.isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - // the handler that waits for readable events after all - // the data gets sucked out in flow. - // This would be easier to follow with a .once() handler - // in flow(), but that is too slow. - this.on('readable', pipeOnReadable); - - state.flowing = true; - process.nextTick(function() { - flow(src); - }); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function() { - var dest = this; - var state = src._readableState; - state.awaitDrain--; - if (state.awaitDrain === 0) - flow(src); - }; -} - -function flow(src) { - var state = src._readableState; - var chunk; - state.awaitDrain = 0; - - function write(dest, i, list) { - var written = dest.write(chunk); - if (false === written) { - state.awaitDrain++; - } - } - - while (state.pipesCount && null !== (chunk = src.read())) { - - if (state.pipesCount === 1) - write(state.pipes, 0, null); - else - state.pipes.forEach(write); - - src.emit('data', chunk); - - // if anyone needs a drain, then we have to wait for that. - if (state.awaitDrain > 0) - return; - } - - // if every destination was unpiped, either before entering this - // function, or in the while loop, then stop flowing. - // - // NB: This is a pretty rare edge case. - if (state.pipesCount === 0) { - state.flowing = false; - - // if there were data event listeners added, then switch to old mode. - if (EE.listenerCount(src, 'data') > 0) - emitDataEvents(src); - return; - } - - // at this point, no one needed a drain, so we just ran out of data - // on the next readable event, start it over again. - state.ranOut = true; -} - -function pipeOnReadable() { - if (this._readableState.ranOut) { - this._readableState.ranOut = false; - flow(this); - } -} - - -Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = state.pipes.indexOf(dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data' && !this._readableState.flowing) - emitDataEvents(this); - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - this.read(0); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { - emitDataEvents(this); - this.read(0); - this.emit('resume'); -}; - -Readable.prototype.pause = function() { - emitDataEvents(this, true); - this.emit('pause'); -}; - -function emitDataEvents(stream, startPaused) { - var state = stream._readableState; - - if (state.flowing) { - // https://github.com/isaacs/readable-stream/issues/16 - throw new Error('Cannot switch to old mode now.'); - } - - var paused = startPaused || false; - var readable = false; - - // convert to an old-style stream. - stream.readable = true; - stream.pipe = Stream.prototype.pipe; - stream.on = stream.addListener = Stream.prototype.on; - - stream.on('readable', function() { - readable = true; - - var c; - while (!paused && (null !== (c = stream.read()))) - stream.emit('data', c); - - if (c === null) { - readable = false; - stream._readableState.needReadable = true; - } - }); - - stream.pause = function() { - paused = true; - this.emit('pause'); - }; - - stream.resume = function() { - paused = false; - if (readable) - process.nextTick(function() { - stream.emit('readable'); - }); - else - this.read(0); - this.emit('resume'); - }; - - // now make it start, just in case it hadn't already. - stream.emit('readable'); -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - if (state.decoder) - chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (typeof stream[i] === 'function' && - typeof this[i] === 'undefined') { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - events.forEach(function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - - - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted && state.calledRead) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index f08b05e5..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); -var util = require('util'); -util.inherits(Transform, Duplex); - - -function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (data !== null && data !== undefined) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - - -function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - var ts = this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('finish', function() { - if ('function' === typeof this._flush) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); -} - -Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (ts.writechunk && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - - -function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var rs = stream._readableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index 56ca47dd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, cb), and it'll handle all -// the drain event emission and buffering. - -module.exports = Writable; -Writable.WritableState = WritableState; - -var util = require('util'); -var assert = require('assert'); -var Stream = require('stream'); - -util.inherits(Writable, Stream); - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; -} - -function WritableState(options, stream) { - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; -} - -function Writable(options) { - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex'))) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - - -function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; -} - -Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (typeof cb !== 'function') - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) - ret = writeOrBuffer(this, state, chunk, encoding, cb); - - return ret; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - typeof chunk === 'string') { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - state.needDrain = !ret; - - if (state.writing) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, len, chunk, encoding, cb); - - return ret; -} - -function doWrite(stream, state, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - cb(er); - }); - else - cb(er); - - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && !state.bufferProcessing && state.buffer.length) - clearBuffer(stream, state); - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - cb(); - if (finished) - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - state.bufferProcessing = false; - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; -} - -Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); -}; - -Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (typeof chunk !== 'undefined' && chunk !== null) - this.write(chunk, encoding); - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); -}; - - -function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); -} - -function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - state.finished = true; - stream.emit('finish'); - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/package.json deleted file mode 100644 index 1a721d32..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "readable-stream", - "version": "1.0.17", - "description": "An exploration of a new kind of readable streams for Node.js", - "main": "readable.js", - "dependencies": {}, - "devDependencies": { - "tap": "~0.2.6" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/readable-stream" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "BSD", - "readme": "# readable-stream\n\nA new class of streams for Node.js\n\nThis module provides the new Stream base classes introduced in Node\nv0.10, for use in Node v0.8. You can use it to have programs that\nhave to work with node v0.8, while being forward-compatible for v0.10\nand beyond. When you drop support for v0.8, you can remove this\nmodule, and only use the native streams.\n\nThis is almost exactly the same codebase as appears in Node v0.10.\nHowever:\n\n1. The exported object is actually the Readable class. Decorating the\n native `stream` module would be global pollution.\n2. In v0.10, you can safely use `base64` as an argument to\n `setEncoding` in Readable streams. However, in v0.8, the\n StringDecoder class has no `end()` method, which is problematic for\n Base64. So, don't use that, because it'll break and be weird.\n\nOther than that, the API is the same as `require('stream')` in v0.10,\nso the API docs are reproduced below.\n\n----------\n\n Stability: 2 - Unstable\n\nA stream is an abstract interface implemented by various objects in\nNode. For example a request to an HTTP server is a stream, as is\nstdout. Streams are readable, writable, or both. All streams are\ninstances of [EventEmitter][]\n\nYou can load the Stream base classes by doing `require('stream')`.\nThere are base classes provided for Readable streams, Writable\nstreams, Duplex streams, and Transform streams.\n\n## Compatibility\n\nIn earlier versions of Node, the Readable stream interface was\nsimpler, but also less powerful and less useful.\n\n* Rather than waiting for you to call the `read()` method, `'data'`\n events would start emitting immediately. If you needed to do some\n I/O to decide how to handle data, then you had to store the chunks\n in some kind of buffer so that they would not be lost.\n* The `pause()` method was advisory, rather than guaranteed. This\n meant that you still had to be prepared to receive `'data'` events\n even when the stream was in a paused state.\n\nIn Node v0.10, the Readable class described below was added. For\nbackwards compatibility with older Node programs, Readable streams\nswitch into \"old mode\" when a `'data'` event handler is added, or when\nthe `pause()` or `resume()` methods are called. The effect is that,\neven if you are not using the new `read()` method and `'readable'`\nevent, you no longer have to worry about losing `'data'` chunks.\n\nMost programs will continue to function normally. However, this\nintroduces an edge case in the following conditions:\n\n* No `'data'` event handler is added.\n* The `pause()` and `resume()` methods are never called.\n\nFor example, consider the following code:\n\n```javascript\n// WARNING! BROKEN!\nnet.createServer(function(socket) {\n\n // we add an 'end' method, but never consume the data\n socket.on('end', function() {\n // It will never get here.\n socket.end('I got your message (but didnt read it)\\n');\n });\n\n}).listen(1337);\n```\n\nIn versions of node prior to v0.10, the incoming message data would be\nsimply discarded. However, in Node v0.10 and beyond, the socket will\nremain paused forever.\n\nThe workaround in this situation is to call the `resume()` method to\ntrigger \"old mode\" behavior:\n\n```javascript\n// Workaround\nnet.createServer(function(socket) {\n\n socket.on('end', function() {\n socket.end('I got your message (but didnt read it)\\n');\n });\n\n // start the flow of data, discarding it.\n socket.resume();\n\n}).listen(1337);\n```\n\nIn addition to new Readable streams switching into old-mode, pre-v0.10\nstyle streams can be wrapped in a Readable class using the `wrap()`\nmethod.\n\n## Class: stream.Readable\n\n\n\nA `Readable Stream` has the following methods, members, and events.\n\nNote that `stream.Readable` is an abstract class designed to be\nextended with an underlying implementation of the `_read(size)`\nmethod. (See below.)\n\n### new stream.Readable([options])\n\n* `options` {Object}\n * `highWaterMark` {Number} The maximum number of bytes to store in\n the internal buffer before ceasing to read from the underlying\n resource. Default=16kb\n * `encoding` {String} If specified, then buffers will be decoded to\n strings using the specified encoding. Default=null\n * `objectMode` {Boolean} Whether this stream should behave\n as a stream of objects. Meaning that stream.read(n) returns\n a single value instead of a Buffer of size n\n\nIn classes that extend the Readable class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n### readable.\\_read(size)\n\n* `size` {Number} Number of bytes to read asynchronously\n\nNote: **This function should NOT be called directly.** It should be\nimplemented by child classes, and called by the internal Readable\nclass methods only.\n\nAll Readable stream implementations must provide a `_read` method\nto fetch data from the underlying resource.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\nWhen data is available, put it into the read queue by calling\n`readable.push(chunk)`. If `push` returns false, then you should stop\nreading. When `_read` is called again, you should start pushing more\ndata.\n\nThe `size` argument is advisory. Implementations where a \"read\" is a\nsingle call that returns data can use this to know how much data to\nfetch. Implementations where that is not relevant, such as TCP or\nTLS, may ignore this argument, and simply provide data whenever it\nbecomes available. There is no need, for example to \"wait\" until\n`size` bytes are available before calling `stream.push(chunk)`.\n\n### readable.push(chunk)\n\n* `chunk` {Buffer | null | String} Chunk of data to push into the read queue\n* return {Boolean} Whether or not more pushes should be performed\n\nNote: **This function should be called by Readable implementors, NOT\nby consumers of Readable subclasses.** The `_read()` function will not\nbe called again until at least one `push(chunk)` call is made. If no\ndata is available, then you MAY call `push('')` (an empty string) to\nallow a future `_read` call, without adding any data to the queue.\n\nThe `Readable` class works by putting data into a read queue to be\npulled out later by calling the `read()` method when the `'readable'`\nevent fires.\n\nThe `push()` method will explicitly insert some data into the read\nqueue. If it is called with `null` then it will signal the end of the\ndata.\n\nIn some cases, you may be wrapping a lower-level source which has some\nsort of pause/resume mechanism, and a data callback. In those cases,\nyou could wrap the low-level source object by doing something like\nthis:\n\n```javascript\n// source is an object with readStop() and readStart() methods,\n// and an `ondata` member that gets called when it has data, and\n// an `onend` member that gets called when the data is over.\n\nvar stream = new Readable();\n\nsource.ondata = function(chunk) {\n // if push() returns false, then we need to stop reading from source\n if (!stream.push(chunk))\n source.readStop();\n};\n\nsource.onend = function() {\n stream.push(null);\n};\n\n// _read will be called when the stream wants to pull more data in\n// the advisory size argument is ignored in this case.\nstream._read = function(n) {\n source.readStart();\n};\n```\n\n### readable.unshift(chunk)\n\n* `chunk` {Buffer | null | String} Chunk of data to unshift onto the read queue\n* return {Boolean} Whether or not more pushes should be performed\n\nThis is the corollary of `readable.push(chunk)`. Rather than putting\nthe data at the *end* of the read queue, it puts it at the *front* of\nthe read queue.\n\nThis is useful in certain use-cases where a stream is being consumed\nby a parser, which needs to \"un-consume\" some data that it has\noptimistically pulled out of the source.\n\n```javascript\n// A parser for a simple data protocol.\n// The \"header\" is a JSON object, followed by 2 \\n characters, and\n// then a message body.\n//\n// Note: This can be done more simply as a Transform stream. See below.\n\nfunction SimpleProtocol(source, options) {\n if (!(this instanceof SimpleProtocol))\n return new SimpleProtocol(options);\n\n Readable.call(this, options);\n this._inBody = false;\n this._sawFirstCr = false;\n\n // source is a readable stream, such as a socket or file\n this._source = source;\n\n var self = this;\n source.on('end', function() {\n self.push(null);\n });\n\n // give it a kick whenever the source is readable\n // read(0) will not consume any bytes\n source.on('readable', function() {\n self.read(0);\n });\n\n this._rawHeader = [];\n this.header = null;\n}\n\nSimpleProtocol.prototype = Object.create(\n Readable.prototype, { constructor: { value: SimpleProtocol }});\n\nSimpleProtocol.prototype._read = function(n) {\n if (!this._inBody) {\n var chunk = this._source.read();\n\n // if the source doesn't have data, we don't have data yet.\n if (chunk === null)\n return this.push('');\n\n // check if the chunk has a \\n\\n\n var split = -1;\n for (var i = 0; i < chunk.length; i++) {\n if (chunk[i] === 10) { // '\\n'\n if (this._sawFirstCr) {\n split = i;\n break;\n } else {\n this._sawFirstCr = true;\n }\n } else {\n this._sawFirstCr = false;\n }\n }\n\n if (split === -1) {\n // still waiting for the \\n\\n\n // stash the chunk, and try again.\n this._rawHeader.push(chunk);\n this.push('');\n } else {\n this._inBody = true;\n var h = chunk.slice(0, split);\n this._rawHeader.push(h);\n var header = Buffer.concat(this._rawHeader).toString();\n try {\n this.header = JSON.parse(header);\n } catch (er) {\n this.emit('error', new Error('invalid simple protocol data'));\n return;\n }\n // now, because we got some extra data, unshift the rest\n // back into the read queue so that our consumer will see it.\n var b = chunk.slice(split);\n this.unshift(b);\n\n // and let them know that we are done parsing the header.\n this.emit('header', this.header);\n }\n } else {\n // from there on, just provide the data to our consumer.\n // careful not to push(null), since that would indicate EOF.\n var chunk = this._source.read();\n if (chunk) this.push(chunk);\n }\n};\n\n// Usage:\nvar parser = new SimpleProtocol(source);\n// Now parser is a readable stream that will emit 'header'\n// with the parsed header data.\n```\n\n### readable.wrap(stream)\n\n* `stream` {Stream} An \"old style\" readable stream\n\nIf you are using an older Node library that emits `'data'` events and\nhas a `pause()` method that is advisory only, then you can use the\n`wrap()` method to create a Readable stream that uses the old stream\nas its data source.\n\nFor example:\n\n```javascript\nvar OldReader = require('./old-api-module.js').OldReader;\nvar oreader = new OldReader;\nvar Readable = require('stream').Readable;\nvar myReader = new Readable().wrap(oreader);\n\nmyReader.on('readable', function() {\n myReader.read(); // etc.\n});\n```\n\n### Event: 'readable'\n\nWhen there is data ready to be consumed, this event will fire.\n\nWhen this event emits, call the `read()` method to consume the data.\n\n### Event: 'end'\n\nEmitted when the stream has received an EOF (FIN in TCP terminology).\nIndicates that no more `'data'` events will happen. If the stream is\nalso writable, it may be possible to continue writing.\n\n### Event: 'data'\n\nThe `'data'` event emits either a `Buffer` (by default) or a string if\n`setEncoding()` was used.\n\nNote that adding a `'data'` event listener will switch the Readable\nstream into \"old mode\", where data is emitted as soon as it is\navailable, rather than waiting for you to call `read()` to consume it.\n\n### Event: 'error'\n\nEmitted if there was an error receiving data.\n\n### Event: 'close'\n\nEmitted when the underlying resource (for example, the backing file\ndescriptor) has been closed. Not all streams will emit this.\n\n### readable.setEncoding(encoding)\n\nMakes the `'data'` event emit a string instead of a `Buffer`. `encoding`\ncan be `'utf8'`, `'utf16le'` (`'ucs2'`), `'ascii'`, or `'hex'`.\n\nThe encoding can also be set by specifying an `encoding` field to the\nconstructor.\n\n### readable.read([size])\n\n* `size` {Number | null} Optional number of bytes to read.\n* Return: {Buffer | String | null}\n\nNote: **This function SHOULD be called by Readable stream users.**\n\nCall this method to consume data once the `'readable'` event is\nemitted.\n\nThe `size` argument will set a minimum number of bytes that you are\ninterested in. If not set, then the entire content of the internal\nbuffer is returned.\n\nIf there is no data to consume, or if there are fewer bytes in the\ninternal buffer than the `size` argument, then `null` is returned, and\na future `'readable'` event will be emitted when more is available.\n\nCalling `stream.read(0)` will always return `null`, and will trigger a\nrefresh of the internal buffer, but otherwise be a no-op.\n\n### readable.pipe(destination, [options])\n\n* `destination` {Writable Stream}\n* `options` {Object} Optional\n * `end` {Boolean} Default=true\n\nConnects this readable stream to `destination` WriteStream. Incoming\ndata on this stream gets written to `destination`. Properly manages\nback-pressure so that a slow destination will not be overwhelmed by a\nfast readable stream.\n\nThis function returns the `destination` stream.\n\nFor example, emulating the Unix `cat` command:\n\n process.stdin.pipe(process.stdout);\n\nBy default `end()` is called on the destination when the source stream\nemits `end`, so that `destination` is no longer writable. Pass `{ end:\nfalse }` as `options` to keep the destination stream open.\n\nThis keeps `writer` open so that \"Goodbye\" can be written at the\nend.\n\n reader.pipe(writer, { end: false });\n reader.on(\"end\", function() {\n writer.end(\"Goodbye\\n\");\n });\n\nNote that `process.stderr` and `process.stdout` are never closed until\nthe process exits, regardless of the specified options.\n\n### readable.unpipe([destination])\n\n* `destination` {Writable Stream} Optional\n\nUndo a previously established `pipe()`. If no destination is\nprovided, then all previously established pipes are removed.\n\n### readable.pause()\n\nSwitches the readable stream into \"old mode\", where data is emitted\nusing a `'data'` event rather than being buffered for consumption via\nthe `read()` method.\n\nCeases the flow of data. No `'data'` events are emitted while the\nstream is in a paused state.\n\n### readable.resume()\n\nSwitches the readable stream into \"old mode\", where data is emitted\nusing a `'data'` event rather than being buffered for consumption via\nthe `read()` method.\n\nResumes the incoming `'data'` events after a `pause()`.\n\n\n## Class: stream.Writable\n\n\n\nA `Writable` Stream has the following methods, members, and events.\n\nNote that `stream.Writable` is an abstract class designed to be\nextended with an underlying implementation of the\n`_write(chunk, encoding, cb)` method. (See below.)\n\n### new stream.Writable([options])\n\n* `options` {Object}\n * `highWaterMark` {Number} Buffer level when `write()` starts\n returning false. Default=16kb\n * `decodeStrings` {Boolean} Whether or not to decode strings into\n Buffers before passing them to `_write()`. Default=true\n\nIn classes that extend the Writable class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n### writable.\\_write(chunk, encoding, callback)\n\n* `chunk` {Buffer | String} The chunk to be written. Will always\n be a buffer unless the `decodeStrings` option was set to `false`.\n* `encoding` {String} If the chunk is a string, then this is the\n encoding type. Ignore chunk is a buffer. Note that chunk will\n **always** be a buffer unless the `decodeStrings` option is\n explicitly set to `false`.\n* `callback` {Function} Call this function (optionally with an error\n argument) when you are done processing the supplied chunk.\n\nAll Writable stream implementations must provide a `_write` method to\nsend data to the underlying resource.\n\nNote: **This function MUST NOT be called directly.** It should be\nimplemented by child classes, and called by the internal Writable\nclass methods only.\n\nCall the callback using the standard `callback(error)` pattern to\nsignal that the write completed successfully or with an error.\n\nIf the `decodeStrings` flag is set in the constructor options, then\n`chunk` may be a string rather than a Buffer, and `encoding` will\nindicate the sort of string that it is. This is to support\nimplementations that have an optimized handling for certain string\ndata encodings. If you do not explicitly set the `decodeStrings`\noption to `false`, then you can safely ignore the `encoding` argument,\nand assume that `chunk` will always be a Buffer.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\n\n### writable.write(chunk, [encoding], [callback])\n\n* `chunk` {Buffer | String} Data to be written\n* `encoding` {String} Optional. If `chunk` is a string, then encoding\n defaults to `'utf8'`\n* `callback` {Function} Optional. Called when this chunk is\n successfully written.\n* Returns {Boolean}\n\nWrites `chunk` to the stream. Returns `true` if the data has been\nflushed to the underlying resource. Returns `false` to indicate that\nthe buffer is full, and the data will be sent out in the future. The\n`'drain'` event will indicate when the buffer is empty again.\n\nThe specifics of when `write()` will return false, is determined by\nthe `highWaterMark` option provided to the constructor.\n\n### writable.end([chunk], [encoding], [callback])\n\n* `chunk` {Buffer | String} Optional final data to be written\n* `encoding` {String} Optional. If `chunk` is a string, then encoding\n defaults to `'utf8'`\n* `callback` {Function} Optional. Called when the final chunk is\n successfully written.\n\nCall this method to signal the end of the data being written to the\nstream.\n\n### Event: 'drain'\n\nEmitted when the stream's write queue empties and it's safe to write\nwithout buffering again. Listen for it when `stream.write()` returns\n`false`.\n\n### Event: 'close'\n\nEmitted when the underlying resource (for example, the backing file\ndescriptor) has been closed. Not all streams will emit this.\n\n### Event: 'finish'\n\nWhen `end()` is called and there are no more chunks to write, this\nevent is emitted.\n\n### Event: 'pipe'\n\n* `source` {Readable Stream}\n\nEmitted when the stream is passed to a readable stream's pipe method.\n\n### Event 'unpipe'\n\n* `source` {Readable Stream}\n\nEmitted when a previously established `pipe()` is removed using the\nsource Readable stream's `unpipe()` method.\n\n## Class: stream.Duplex\n\n\n\nA \"duplex\" stream is one that is both Readable and Writable, such as a\nTCP socket connection.\n\nNote that `stream.Duplex` is an abstract class designed to be\nextended with an underlying implementation of the `_read(size)`\nand `_write(chunk, encoding, callback)` methods as you would with a Readable or\nWritable stream class.\n\nSince JavaScript doesn't have multiple prototypal inheritance, this\nclass prototypally inherits from Readable, and then parasitically from\nWritable. It is thus up to the user to implement both the lowlevel\n`_read(n)` method as well as the lowlevel `_write(chunk, encoding, cb)` method\non extension duplex classes.\n\n### new stream.Duplex(options)\n\n* `options` {Object} Passed to both Writable and Readable\n constructors. Also has the following fields:\n * `allowHalfOpen` {Boolean} Default=true. If set to `false`, then\n the stream will automatically end the readable side when the\n writable side ends and vice versa.\n\nIn classes that extend the Duplex class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n## Class: stream.Transform\n\nA \"transform\" stream is a duplex stream where the output is causally\nconnected in some way to the input, such as a zlib stream or a crypto\nstream.\n\nThere is no requirement that the output be the same size as the input,\nthe same number of chunks, or arrive at the same time. For example, a\nHash stream will only ever have a single chunk of output which is\nprovided when the input is ended. A zlib stream will either produce\nmuch smaller or much larger than its input.\n\nRather than implement the `_read()` and `_write()` methods, Transform\nclasses must implement the `_transform()` method, and may optionally\nalso implement the `_flush()` method. (See below.)\n\n### new stream.Transform([options])\n\n* `options` {Object} Passed to both Writable and Readable\n constructors.\n\nIn classes that extend the Transform class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n### transform.\\_transform(chunk, encoding, callback)\n\n* `chunk` {Buffer | String} The chunk to be transformed. Will always\n be a buffer unless the `decodeStrings` option was set to `false`.\n* `encoding` {String} If the chunk is a string, then this is the\n encoding type. (Ignore if `decodeStrings` chunk is a buffer.)\n* `callback` {Function} Call this function (optionally with an error\n argument) when you are done processing the supplied chunk.\n\nNote: **This function MUST NOT be called directly.** It should be\nimplemented by child classes, and called by the internal Transform\nclass methods only.\n\nAll Transform stream implementations must provide a `_transform`\nmethod to accept input and produce output.\n\n`_transform` should do whatever has to be done in this specific\nTransform class, to handle the bytes being written, and pass them off\nto the readable portion of the interface. Do asynchronous I/O,\nprocess things, and so on.\n\nCall `transform.push(outputChunk)` 0 or more times to generate output\nfrom this input chunk, depending on how much data you want to output\nas a result of this chunk.\n\nCall the callback function only when the current chunk is completely\nconsumed. Note that there may or may not be output as a result of any\nparticular input chunk.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\n### transform.\\_flush(callback)\n\n* `callback` {Function} Call this function (optionally with an error\n argument) when you are done flushing any remaining data.\n\nNote: **This function MUST NOT be called directly.** It MAY be implemented\nby child classes, and if so, will be called by the internal Transform\nclass methods only.\n\nIn some cases, your transform operation may need to emit a bit more\ndata at the end of the stream. For example, a `Zlib` compression\nstream will store up some internal state so that it can optimally\ncompress the output. At the end, however, it needs to do the best it\ncan with what is left, so that the data will be complete.\n\nIn those cases, you can implement a `_flush` method, which will be\ncalled at the very end, after all the written data is consumed, but\nbefore emitting `end` to signal the end of the readable side. Just\nlike with `_transform`, call `transform.push(chunk)` zero or more\ntimes, as appropriate, and call `callback` when the flush operation is\ncomplete.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\n### Example: `SimpleProtocol` parser\n\nThe example above of a simple protocol parser can be implemented much\nmore simply by using the higher level `Transform` stream class.\n\nIn this example, rather than providing the input as an argument, it\nwould be piped into the parser, which is a more idiomatic Node stream\napproach.\n\n```javascript\nfunction SimpleProtocol(options) {\n if (!(this instanceof SimpleProtocol))\n return new SimpleProtocol(options);\n\n Transform.call(this, options);\n this._inBody = false;\n this._sawFirstCr = false;\n this._rawHeader = [];\n this.header = null;\n}\n\nSimpleProtocol.prototype = Object.create(\n Transform.prototype, { constructor: { value: SimpleProtocol }});\n\nSimpleProtocol.prototype._transform = function(chunk, encoding, done) {\n if (!this._inBody) {\n // check if the chunk has a \\n\\n\n var split = -1;\n for (var i = 0; i < chunk.length; i++) {\n if (chunk[i] === 10) { // '\\n'\n if (this._sawFirstCr) {\n split = i;\n break;\n } else {\n this._sawFirstCr = true;\n }\n } else {\n this._sawFirstCr = false;\n }\n }\n\n if (split === -1) {\n // still waiting for the \\n\\n\n // stash the chunk, and try again.\n this._rawHeader.push(chunk);\n } else {\n this._inBody = true;\n var h = chunk.slice(0, split);\n this._rawHeader.push(h);\n var header = Buffer.concat(this._rawHeader).toString();\n try {\n this.header = JSON.parse(header);\n } catch (er) {\n this.emit('error', new Error('invalid simple protocol data'));\n return;\n }\n // and let them know that we are done parsing the header.\n this.emit('header', this.header);\n\n // now, because we got some extra data, emit this first.\n this.push(b);\n }\n } else {\n // from there on, just provide the data to our consumer as-is.\n this.push(b);\n }\n done();\n};\n\nvar parser = new SimpleProtocol();\nsource.pipe(parser)\n\n// Now parser is a readable stream that will emit 'header'\n// with the parsed header data.\n```\n\n\n## Class: stream.PassThrough\n\nThis is a trivial implementation of a `Transform` stream that simply\npasses the input bytes across to the output. Its purpose is mainly\nfor examples and testing, but there are occasionally use cases where\nit can come in handy.\n\n\n[EventEmitter]: events.html#events_class_events_eventemitter\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/isaacs/readable-stream/issues" - }, - "homepage": "https://github.com/isaacs/readable-stream", - "_id": "readable-stream@1.0.17", - "_from": "readable-stream@~1.0.2" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/passthrough.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/passthrough.js deleted file mode 100644 index 27e8d8a5..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/passthrough.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_passthrough.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/readable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/readable.js deleted file mode 100644 index 4d1ddfc7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,6 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/test/common.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/test/common.js deleted file mode 100644 index 1dec2e35..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/test/common.js +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var path = require('path'); -var assert = require('assert'); - -exports.testDir = path.dirname(__filename); -exports.fixturesDir = path.join(exports.testDir, 'fixtures'); -exports.libDir = path.join(exports.testDir, '../lib'); -exports.tmpDir = path.join(exports.testDir, 'tmp'); -exports.PORT = 12346; - -if (process.platform === 'win32') { - exports.PIPE = '\\\\.\\pipe\\libuv-test'; -} else { - exports.PIPE = exports.tmpDir + '/test.sock'; -} - -var util = require('util'); -for (var i in util) exports[i] = util[i]; -//for (var i in exports) global[i] = exports[i]; - -function protoCtrChain(o) { - var result = []; - for (; o; o = o.__proto__) { result.push(o.constructor); } - return result.join(); -} - -exports.indirectInstanceOf = function(obj, cls) { - if (obj instanceof cls) { return true; } - var clsChain = protoCtrChain(cls.prototype); - var objChain = protoCtrChain(obj); - return objChain.slice(-clsChain.length) === clsChain; -}; - - -exports.ddCommand = function(filename, kilobytes) { - if (process.platform === 'win32') { - var p = path.resolve(exports.fixturesDir, 'create-file.js'); - return '"' + process.argv[0] + '" "' + p + '" "' + - filename + '" ' + (kilobytes * 1024); - } else { - return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes; - } -}; - - -exports.spawnPwd = function(options) { - var spawn = require('child_process').spawn; - - if (process.platform === 'win32') { - return spawn('cmd.exe', ['/c', 'cd'], options); - } else { - return spawn('pwd', [], options); - } -}; - - -// Turn this off if the test should not check for global leaks. -exports.globalCheck = true; - -process.on('exit', function() { - if (!exports.globalCheck) return; - var knownGlobals = [setTimeout, - setInterval, - global.setImmediate, - clearTimeout, - clearInterval, - global.clearImmediate, - console, - Buffer, - process, - global]; - - if (global.errno) { - knownGlobals.push(errno); - } - - if (global.gc) { - knownGlobals.push(gc); - } - - if (global.DTRACE_HTTP_SERVER_RESPONSE) { - knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE); - knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST); - knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE); - knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST); - knownGlobals.push(DTRACE_NET_STREAM_END); - knownGlobals.push(DTRACE_NET_SERVER_CONNECTION); - knownGlobals.push(DTRACE_NET_SOCKET_READ); - knownGlobals.push(DTRACE_NET_SOCKET_WRITE); - } - if (global.COUNTER_NET_SERVER_CONNECTION) { - knownGlobals.push(COUNTER_NET_SERVER_CONNECTION); - knownGlobals.push(COUNTER_NET_SERVER_CONNECTION_CLOSE); - knownGlobals.push(COUNTER_HTTP_SERVER_REQUEST); - knownGlobals.push(COUNTER_HTTP_SERVER_RESPONSE); - knownGlobals.push(COUNTER_HTTP_CLIENT_REQUEST); - knownGlobals.push(COUNTER_HTTP_CLIENT_RESPONSE); - } - - if (global.ArrayBuffer) { - knownGlobals.push(ArrayBuffer); - knownGlobals.push(Int8Array); - knownGlobals.push(Uint8Array); - knownGlobals.push(Uint8ClampedArray); - knownGlobals.push(Int16Array); - knownGlobals.push(Uint16Array); - knownGlobals.push(Int32Array); - knownGlobals.push(Uint32Array); - knownGlobals.push(Float32Array); - knownGlobals.push(Float64Array); - knownGlobals.push(DataView); - } - - for (var x in global) { - var found = false; - - for (var y in knownGlobals) { - if (global[x] === knownGlobals[y]) { - found = true; - break; - } - } - - if (!found) { - console.error('Unknown global: %s', x); - assert.ok(false, 'Unknown global found'); - } - } -}); - - -var mustCallChecks = []; - - -function runCallChecks() { - var failed = mustCallChecks.filter(function(context) { - return context.actual !== context.expected; - }); - - failed.forEach(function(context) { - console.log('Mismatched %s function calls. Expected %d, actual %d.', - context.name, - context.expected, - context.actual); - console.log(context.stack.split('\n').slice(2).join('\n')); - }); - - if (failed.length) process.exit(1); -} - - -exports.mustCall = function(fn, expected) { - if (typeof expected !== 'number') expected = 1; - - var context = { - expected: expected, - actual: 0, - stack: (new Error).stack, - name: fn.name || '' - }; - - // add the exit listener only once to avoid listener leak warnings - if (mustCallChecks.length === 0) process.on('exit', runCallChecks); - - mustCallChecks.push(context); - - return function() { - context.actual++; - return fn.apply(this, arguments); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/test/fixtures/x1024.txt b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/test/fixtures/x1024.txt deleted file mode 100644 index c6a9d2f1..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/test/fixtures/x1024.txt +++ /dev/null @@ -1 +0,0 @@ -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/transform.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/transform.js deleted file mode 100644 index 5d482f07..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/transform.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_transform.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/writable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/writable.js deleted file mode 100644 index e1e9efdf..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/writable.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_writable.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/zlib.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/zlib.js deleted file mode 100644 index a30ca209..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/node_modules/readable-stream/zlib.js +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var Transform = require('./lib/_stream_transform.js'); - -var binding = process.binding('zlib'); -var util = require('util'); -var assert = require('assert').ok; - -// zlib doesn't provide these, so kludge them in following the same -// const naming scheme zlib uses. -binding.Z_MIN_WINDOWBITS = 8; -binding.Z_MAX_WINDOWBITS = 15; -binding.Z_DEFAULT_WINDOWBITS = 15; - -// fewer than 64 bytes per chunk is stupid. -// technically it could work with as few as 8, but even 64 bytes -// is absurdly low. Usually a MB or more is best. -binding.Z_MIN_CHUNK = 64; -binding.Z_MAX_CHUNK = Infinity; -binding.Z_DEFAULT_CHUNK = (16 * 1024); - -binding.Z_MIN_MEMLEVEL = 1; -binding.Z_MAX_MEMLEVEL = 9; -binding.Z_DEFAULT_MEMLEVEL = 8; - -binding.Z_MIN_LEVEL = -1; -binding.Z_MAX_LEVEL = 9; -binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; - -// expose all the zlib constants -Object.keys(binding).forEach(function(k) { - if (k.match(/^Z/)) exports[k] = binding[k]; -}); - -// translation table for return codes. -exports.codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR -}; - -Object.keys(exports.codes).forEach(function(k) { - exports.codes[exports.codes[k]] = k; -}); - -exports.Deflate = Deflate; -exports.Inflate = Inflate; -exports.Gzip = Gzip; -exports.Gunzip = Gunzip; -exports.DeflateRaw = DeflateRaw; -exports.InflateRaw = InflateRaw; -exports.Unzip = Unzip; - -exports.createDeflate = function(o) { - return new Deflate(o); -}; - -exports.createInflate = function(o) { - return new Inflate(o); -}; - -exports.createDeflateRaw = function(o) { - return new DeflateRaw(o); -}; - -exports.createInflateRaw = function(o) { - return new InflateRaw(o); -}; - -exports.createGzip = function(o) { - return new Gzip(o); -}; - -exports.createGunzip = function(o) { - return new Gunzip(o); -}; - -exports.createUnzip = function(o) { - return new Unzip(o); -}; - - -// Convenience methods. -// compress/decompress a string or buffer in one step. -exports.deflate = function(buffer, callback) { - zlibBuffer(new Deflate(), buffer, callback); -}; - -exports.gzip = function(buffer, callback) { - zlibBuffer(new Gzip(), buffer, callback); -}; - -exports.deflateRaw = function(buffer, callback) { - zlibBuffer(new DeflateRaw(), buffer, callback); -}; - -exports.unzip = function(buffer, callback) { - zlibBuffer(new Unzip(), buffer, callback); -}; - -exports.inflate = function(buffer, callback) { - zlibBuffer(new Inflate(), buffer, callback); -}; - -exports.gunzip = function(buffer, callback) { - zlibBuffer(new Gunzip(), buffer, callback); -}; - -exports.inflateRaw = function(buffer, callback) { - zlibBuffer(new InflateRaw(), buffer, callback); -}; - -function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); - - engine.end(buffer); - flow(); - - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; - } - engine.once('readable', flow); - } - - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } - - function onEnd() { - var buf = Buffer.concat(buffers, nread); - buffers = []; - callback(null, buf); - } -} - - -// generic zlib -// minimal 2-byte header -function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); -} - -function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); -} - - - -// gzip - bigger header, same deflate compression -function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); -} - -function Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); -} - - - -// raw - no header -function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); -} - -function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); -} - - -// auto-detect header. -function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); -} - - -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. - -function Zlib(opts, mode) { - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; - - Transform.call(this, opts); - - // means a different thing there. - this._readableState.chunkSize = null; - - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || - opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } - } - - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || - opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } - } - - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || - opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } - } - - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || - opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } - - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && - opts.strategy != exports.Z_HUFFMAN_ONLY && - opts.strategy != exports.Z_RLE && - opts.strategy != exports.Z_FIXED && - opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } - } - - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } - } - - this._binding = new binding.Zlib(mode); - - var self = this; - this._hadError = false; - this._binding.onerror = function(message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - self._binding = null; - self._hadError = true; - - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; - - this._binding.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, - opts.level || exports.Z_DEFAULT_COMPRESSION, - opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, - opts.strategy || exports.Z_DEFAULT_STRATEGY, - opts.dictionary); - - this._buffer = new Buffer(this._chunkSize); - this._offset = 0; - this._closed = false; - - this.once('end', this.close); -} - -util.inherits(Zlib, Transform); - -Zlib.prototype.reset = function reset() { - return this._binding.reset(); -}; - -Zlib.prototype._flush = function(output, callback) { - var rs = this._readableState; - var self = this; - this._transform(null, output, function(er) { - if (er) - return callback(er); - - // now a weird thing happens... it could be that you called flush - // but everything had already actually been consumed, but it wasn't - // enough to get over the Readable class's lowWaterMark. - // In that case, we emit 'readable' now to make sure it's consumed. - if (rs.length && - rs.length < rs.lowWaterMark && - !rs.ended && - rs.needReadable) - self.emit('readable'); - - callback(); - }); -}; - -Zlib.prototype.flush = function(callback) { - var ws = this._writableState; - var ts = this._transformState; - - if (ws.writing) { - ws.needDrain = true; - var self = this; - this.once('drain', function() { - self._flush(ts.output, callback); - }); - return; - } - - this._flush(ts.output, callback || function() {}); -}; - -Zlib.prototype.close = function(callback) { - if (callback) - process.nextTick(callback); - - if (this._closed) - return; - - this._closed = true; - - this._binding.close(); - - var self = this; - process.nextTick(function() { - self.emit('close'); - }); -}; - -Zlib.prototype._transform = function(chunk, output, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); - - if (chunk !== null && !Buffer.isBuffer(chunk)) - return cb(new Error('invalid input')); - - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag. - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) - flushFlag = binding.Z_FINISH; - else if (chunk === null) - flushFlag = binding.Z_FULL_FLUSH; - else - flushFlag = binding.Z_NO_FLUSH; - - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; - - var req = this._binding.write(flushFlag, - chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - - req.buffer = chunk; - req.callback = callback; - - var self = this; - function callback(availInAfter, availOutAfter, buffer) { - if (self._hadError) - return; - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - output(out); - } - - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = new Buffer(self._chunkSize); - } - - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += (availInBefore - availInAfter); - availInBefore = availInAfter; - - var newReq = self._binding.write(flushFlag, - chunk, - inOff, - availInBefore, - self._buffer, - self._offset, - self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } - - // finished with the chunk. - cb(); - } -}; - -util.inherits(Deflate, Zlib); -util.inherits(Inflate, Zlib); -util.inherits(Gzip, Zlib); -util.inherits(Gunzip, Zlib); -util.inherits(DeflateRaw, Zlib); -util.inherits(InflateRaw, Zlib); -util.inherits(Unzip, Zlib); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/package.json deleted file mode 100644 index 7f81a35f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "bl", - "version": "0.6.0", - "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!", - "main": "bl.js", - "scripts": { - "test": "tape test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/rvagg/bl.git" - }, - "homepage": "https://github.com/rvagg/bl", - "authors": [ - "Rod Vagg (https://github.com/rvagg)", - "Matteo Collina (https://github.com/mcollina)" - ], - "keywords": [ - "buffer", - "buffers", - "stream", - "awesomesauce" - ], - "license": "MIT", - "dependencies": { - "readable-stream": "~1.0.2" - }, - "devDependencies": { - "tape": "*", - "hash_file": "*" - }, - "readme": "# bl *(BufferList)*\n\n[![Build Status](https://secure.travis-ci.org/rvagg/bl.png)](http://travis-ci.org/rvagg/bl)\n\n**A Node.js Buffer list collector, reader and streamer thingy.**\n\n**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!\n\nThe original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.\n\n```js\nconst BufferList = require('bl')\n\nvar bl = new BufferList()\nbl.append(new Buffer('abcd'))\nbl.append(new Buffer('efg'))\nbl.append('hi') // bl will also accept & convert Strings\nbl.append(new Buffer('j'))\nbl.append(new Buffer([ 0x3, 0x4 ]))\n\nconsole.log(bl.length) // 12\n\nconsole.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'\nconsole.log(bl.slice(3, 10).toString('ascii')) // 'defghij'\nconsole.log(bl.slice(3, 6).toString('ascii')) // 'def'\nconsole.log(bl.slice(3, 8).toString('ascii')) // 'defgh'\nconsole.log(bl.slice(5, 10).toString('ascii')) // 'fghij'\n\n// or just use toString!\nconsole.log(bl.toString()) // 'abcdefghij\\u0003\\u0004'\nconsole.log(bl.toString('ascii', 3, 8)) // 'defgh'\nconsole.log(bl.toString('ascii', 5, 10)) // 'fghij'\n\n// other standard Buffer readables\nconsole.log(bl.readUInt16BE(10)) // 0x0304\nconsole.log(bl.readUInt16LE(10)) // 0x0403\n```\n\nGive it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:\n\n```js\nconst bl = require('bl')\n , fs = require('fs')\n\nfs.createReadStream('README.md')\n .pipe(bl(function (err, data) { // note 'new' isn't strictly required\n // `data` is a complete Buffer object containing the full data\n console.log(data.toString())\n })\n```\n\nNote that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.\n\nOr to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):\n```js\nconst hyperquest = require('hyperquest')\n , bl = require('bl')\n , url = 'https://raw.github.com/rvagg/bl/master/README.md'\n\nhyperquest(url).pipe(bl(function (err, data) {\n console.log(data.toString())\n}))\n```\n\nOr, use it as a readable stream to recompose a list of Buffers to an output source:\n\n```js\nconst BufferList = require('bl')\n , fs = require('fs')\n\nvar bl = new BufferList()\nbl.append(new Buffer('abcd'))\nbl.append(new Buffer('efg'))\nbl.append(new Buffer('hi'))\nbl.append(new Buffer('j'))\n\nbl.pipe(fs.createWriteStream('gibberish.txt'))\n```\n\n## API\n\n * new BufferList([ callback ])\n * bl.length\n * bl.append(buffer)\n * bl.get(index)\n * bl.slice([ start[, end ] ])\n * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])\n * bl.duplicate()\n * bl.consume(bytes)\n * bl.toString([encoding, [ start, [ end ]]])\n * bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()\n * Streams\n\n--------------------------------------------------------\n\n### new BufferList([ callback | buffer | buffer array ])\nThe constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.\n\nNormally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.\n\n`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:\n\n```js\nvar bl = require('bl')\nvar myinstance = bl()\n\n// equivilant to:\n\nvar BufferList = require('bl')\nvar myinstance = new BufferList()\n```\n\n--------------------------------------------------------\n\n### bl.length\nGet the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.\n\n--------------------------------------------------------\n\n### bl.append(buffer)\n`append(buffer)` adds an additional buffer to the internal list.\n\n--------------------------------------------------------\n\n### bl.get(index)\n`get()` will return the byte at the specified index.\n\n--------------------------------------------------------\n\n### bl.slice([ start, [ end ] ])\n`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.\n\nIf the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.\n\n--------------------------------------------------------\n\n### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])\n`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.\n\n--------------------------------------------------------\n\n### bl.duplicate()\n`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:\n\n```js\nvar bl = new BufferList()\n\nbl.append('hello')\nbl.append(' world')\nbl.append('\\n')\n\nbl.duplicate().pipe(process.stdout, { end: false })\n\nconsole.log(bl.toString())\n```\n\n--------------------------------------------------------\n\n### bl.consume(bytes)\n`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.\n\n--------------------------------------------------------\n\n### bl.toString([encoding, [ start, [ end ]]])\n`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.\n\n--------------------------------------------------------\n\n### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()\n\nAll of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.\n\nSee the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.\n\n--------------------------------------------------------\n\n### Streams\n**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.\n\n--------------------------------------------------------\n\n## Contributors\n\n**bl** is brought to you by the following hackers:\n\n * [Rod Vagg](https://github.com/rvagg)\n * [Matteo Collina](https://github.com/mcollina)\n\n=======\n\n## License\n\n**bl** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/rvagg/bl/issues" - }, - "_id": "bl@0.6.0", - "_from": "bl@" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/test.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/test.js deleted file mode 100644 index 1831a11a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/bl/test.js +++ /dev/null @@ -1,442 +0,0 @@ -const tape = require('tape') - , crypto = require('crypto') - , fs = require('fs') - , hash = require('hash_file') - , BufferList = require('./') - -tape('single bytes from single buffer', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abcd')) - - t.equal(bl.length, 4) - - t.equal(bl.get(0), 97) - t.equal(bl.get(1), 98) - t.equal(bl.get(2), 99) - t.equal(bl.get(3), 100) - - t.end() -}) - -tape('single bytes from multiple buffers', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.length, 10) - - t.equal(bl.get(0), 97) - t.equal(bl.get(1), 98) - t.equal(bl.get(2), 99) - t.equal(bl.get(3), 100) - t.equal(bl.get(4), 101) - t.equal(bl.get(5), 102) - t.equal(bl.get(6), 103) - t.equal(bl.get(7), 104) - t.equal(bl.get(8), 105) - t.equal(bl.get(9), 106) - t.end() -}) - -tape('multi bytes from single buffer', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abcd')) - - t.equal(bl.length, 4) - - t.equal(bl.slice(0, 4).toString('ascii'), 'abcd') - t.equal(bl.slice(0, 3).toString('ascii'), 'abc') - t.equal(bl.slice(1, 4).toString('ascii'), 'bcd') - - t.end() -}) - -tape('multiple bytes from multiple buffers', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - - t.end() -}) - -tape('consuming from multiple buffers', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - bl.consume(3) - t.equal(bl.length, 7) - t.equal(bl.slice(0, 7).toString('ascii'), 'defghij') - - bl.consume(2) - t.equal(bl.length, 5) - t.equal(bl.slice(0, 5).toString('ascii'), 'fghij') - - bl.consume(1) - t.equal(bl.length, 4) - t.equal(bl.slice(0, 4).toString('ascii'), 'ghij') - - bl.consume(1) - t.equal(bl.length, 3) - t.equal(bl.slice(0, 3).toString('ascii'), 'hij') - - bl.consume(2) - t.equal(bl.length, 1) - t.equal(bl.slice(0, 1).toString('ascii'), 'j') - - t.end() -}) - -tape('test readUInt8 / readInt8', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt8(2), 0x3) - t.equal(bl.readInt8(2), 0x3) - t.equal(bl.readUInt8(3), 0x4) - t.equal(bl.readInt8(3), 0x4) - t.equal(bl.readUInt8(4), 0x23) - t.equal(bl.readInt8(4), 0x23) - t.equal(bl.readUInt8(5), 0x42) - t.equal(bl.readInt8(5), 0x42) - t.end() -}) - -tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt16BE(2), 0x0304) - t.equal(bl.readUInt16LE(2), 0x0403) - t.equal(bl.readInt16BE(2), 0x0304) - t.equal(bl.readInt16LE(2), 0x0403) - t.equal(bl.readUInt16BE(3), 0x0423) - t.equal(bl.readUInt16LE(3), 0x2304) - t.equal(bl.readInt16BE(3), 0x0423) - t.equal(bl.readInt16LE(3), 0x2304) - t.equal(bl.readUInt16BE(4), 0x2342) - t.equal(bl.readUInt16LE(4), 0x4223) - t.equal(bl.readInt16BE(4), 0x2342) - t.equal(bl.readInt16LE(4), 0x4223) - t.end() -}) - -tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt32BE(2), 0x03042342) - t.equal(bl.readUInt32LE(2), 0x42230403) - t.equal(bl.readInt32BE(2), 0x03042342) - t.equal(bl.readInt32LE(2), 0x42230403) - t.end() -}) - -tape('test readFloatLE / readFloatBE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x00 - buf2[2] = 0x00 - buf3[0] = 0x80 - buf3[1] = 0x3f - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readFloatLE(2), 0x01) - t.end() -}) - -tape('test readDoubleLE / readDoubleBE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(10) - , bl = new BufferList() - - buf2[1] = 0x55 - buf2[2] = 0x55 - buf3[0] = 0x55 - buf3[1] = 0x55 - buf3[2] = 0x55 - buf3[3] = 0x55 - buf3[4] = 0xd5 - buf3[5] = 0x3f - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readDoubleLE(2), 0.3333333333333333) - t.end() -}) - -tape('test toString', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.toString('ascii', 0, 10), 'abcdefghij') - t.equal(bl.toString('ascii', 3, 10), 'defghij') - t.equal(bl.toString('ascii', 3, 6), 'def') - t.equal(bl.toString('ascii', 3, 8), 'defgh') - t.equal(bl.toString('ascii', 5, 10), 'fghij') - - t.end() -}) - -tape('test toString encoding', function (t) { - var bl = new BufferList() - , b = new Buffer('abcdefghij\xff\x00') - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - bl.append(new Buffer('\xff\x00')) - - 'hex utf8 utf-8 ascii binary base64 ucs2 ucs-2 utf16le utf-16le' - .split(' ') - .forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc)) - }) - - t.end() -}) - -tape('test stream', function (t) { - var random = crypto.randomBytes(1024 * 1024) - , rndhash = hash(random, 'md5') - , md5sum = crypto.createHash('md5') - , bl = new BufferList(function (err, buf) { - t.ok(Buffer.isBuffer(buf)) - t.ok(err === null) - t.equal(rndhash, hash(bl.slice(), 'md5')) - t.equal(rndhash, hash(buf, 'md5')) - - bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat')) - .on('close', function () { - var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat') - s.on('data', md5sum.update.bind(md5sum)) - s.on('end', function() { - t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!') - t.end() - }) - }) - - }) - - fs.writeFileSync('/tmp/bl_test_rnd.dat', random) - fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl) -}) - -tape('instantiation with Buffer', function (t) { - var buf = crypto.randomBytes(1024) - , buf2 = crypto.randomBytes(1024) - , b = BufferList(buf) - - t.equal(hash(buf, 'md5'), hash(b.slice(), 'md5'), 'same hash!') - b = BufferList([ buf, buf2 ]) - t.equal(hash(b.slice(), 'md5'), hash(Buffer.concat([ buf, buf2 ]), 'md5'), 'same hash!') - t.end() -}) - -tape('test String appendage', function (t) { - var bl = new BufferList() - , b = new Buffer('abcdefghij\xff\x00') - - bl.append('abcd') - bl.append('efg') - bl.append('hi') - bl.append('j') - bl.append('\xff\x00') - - 'hex utf8 utf-8 ascii binary base64 ucs2 ucs-2 utf16le utf-16le' - .split(' ') - .forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc)) - }) - - t.end() -}) - -tape('write nothing, should get empty buffer', function (t) { - t.plan(3) - BufferList(function (err, data) { - t.notOk(err, 'no error') - t.ok(Buffer.isBuffer(data), 'got a buffer') - t.equal(0, data.length, 'got a zero-length buffer') - t.end() - }).end() -}) - -tape('unicode string', function (t) { - t.plan(2) - var inp1 = '\u2600' - , inp2 = '\u2603' - , exp = inp1 + ' and ' + inp2 - , bl = BufferList() - bl.write(inp1) - bl.write(' and ') - bl.write(inp2) - t.equal(exp, bl.toString()) - t.equal(new Buffer(exp).toString('hex'), bl.toString('hex')) -}) - -tape('should emit finish', function (t) { - var source = BufferList() - , dest = BufferList() - - source.write('hello') - source.pipe(dest) - - dest.on('finish', function () { - t.equal(dest.toString('utf8'), 'hello') - t.end() - }) -}) - -tape('basic copy', function (t) { - var buf = crypto.randomBytes(1024) - , buf2 = new Buffer(1024) - , b = BufferList(buf) - - b.copy(buf2) - t.equal(hash(b.slice(), 'md5'), hash(buf2, 'md5'), 'same hash!') - t.end() -}) - -tape('copy after many appends', function (t) { - var buf = crypto.randomBytes(512) - , buf2 = new Buffer(1024) - , b = BufferList(buf) - - b.append(buf) - b.copy(buf2) - t.equal(hash(b.slice(), 'md5'), hash(buf2, 'md5'), 'same hash!') - t.end() -}) - -tape('copy at a precise position', function (t) { - var buf = crypto.randomBytes(1004) - , buf2 = new Buffer(1024) - , b = BufferList(buf) - - b.copy(buf2, 20) - t.equal(hash(b.slice(), 'md5'), hash(buf2.slice(20), 'md5'), 'same hash!') - t.end() -}) - -tape('copy starting from a precise location', function (t) { - var buf = crypto.randomBytes(10) - , buf2 = new Buffer(5) - , b = BufferList(buf) - - b.copy(buf2, 0, 5) - t.equal(hash(b.slice(5), 'md5'), hash(buf2, 'md5'), 'same hash!') - t.end() -}) - -tape('copy in an interval', function (t) { - var buf = crypto.randomBytes(10) - , buf2 = new Buffer(3) - , b = BufferList(buf) - , expected = new Buffer(3) - - // put the same old data there - buf2.copy(expected) - buf.copy(expected, 0, 5, 7) - - b.copy(buf2, 0, 5, 7) - t.equal(hash(expected, 'md5'), hash(buf2, 'md5'), 'same hash!') - t.end() -}) - -tape('copy an interval between two buffers', function (t) { - var buf = crypto.randomBytes(10) - , buf2 = new Buffer(10) - , b = BufferList(buf) - - b.append(buf) - b.copy(buf2, 0, 5, 15) - - t.equal(hash(b.slice(5, 15), 'md5'), hash(buf2, 'md5'), 'same hash!') - t.end() -}) - -tape('duplicate', function (t) { - t.plan(2) - - var bl = new BufferList('abcdefghij\xff\x00') - , dup = bl.duplicate() - - t.equal(bl.prototype, dup.prototype) - t.equal(bl.toString('hex'), dup.toString('hex')) -}) - -tape('handle error', function (t) { - t.plan(2) - fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) { - t.ok(err instanceof Error, 'has error') - t.notOk(data, 'no data') - })) -}) \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.jshintrc b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.jshintrc deleted file mode 100644 index db1ddbf3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.jshintrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "indent": 2, - "eqnull": true, - "laxbreak": true, - "proto": true, - "undef": true, - "node": true, - "quotmark": "single", - "globals": { - "expect": true, - "it": true, - "describe": true, - "beforeEach": true - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.npmignore deleted file mode 100644 index 64b7e3f2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -src/ -support/ -tests/ -examples/ -*.sock -*.tmproj -coverage.html -lib-cov diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.travis.yml deleted file mode 100644 index bff44acc..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - 0.8 - - "0.10" - - 0.11 -matrix: - fast_finish: true - allow_failures: - - node_js: 0.11 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/CONTRIBUTING.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/CONTRIBUTING.md deleted file mode 100644 index cc38bb8d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/CONTRIBUTING.md +++ /dev/null @@ -1,47 +0,0 @@ -# Contributing to Cheerio - -Thanks for your interest in contributing to the project! Here's a rundown of -how we'd like to work with you: - -1. File an issue on GitHub describing the contribution you'd like to make. This - will help us to get you started on the right foot. -2. Create a single commit that addresses the issue: - 1. Follow the project's code style (see below) - 2. Add enough unit tests to "prove" that your patch is correct - 3. Update the project documentation as needed (see below) - 4. Describe your approach with as much detail as necessary in the git - commit message -3. Open a pull request, and reference the initial issue in the pull request - message. - -# Documentation - -Any API change should be reflected in the project's README.md file. Reuse -[jQuery's documentation](http://api.jquery.com) wherever possible, but take -care to note aspects that make Cheerio distinct. - -# Code Style - -This section is by no means complete. For undocumented stylistic choices, -please try to maintain consistency with the code base. - -- Single quotes: `'` -- Whitespace - - Two-space "soft" tabs - - Once space following control flow statements (`if (condition) {` rather - than `if(condition) {`) - - Remove trailing spaces - - [End each file with a newline - character.](https://github.com/editorconfig/editorconfig/wiki/Newline-at-End-of-File-Support) -- Terminate every statement with a semicolon -- Private functionality (for re-using functionality that isn't part of the - jQuery API) - - *Static methods*: If the functionality does not require a reference to a - Cheerio instance, simply define a named function within the module it is - needed. - - *Instance methods*: If the functionality requires a reference to a Cheerio - instance, informally define the method as "private" using the following - conventions: - - Define the method as a function on the Cheerio prototype - - Prefix the method name with an underscore (`_`) character - - Include `@api private` in the code comment the documents the method diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/History.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/History.md deleted file mode 100644 index f5be0de5..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/History.md +++ /dev/null @@ -1,321 +0,0 @@ - -0.13.1 / 2014-01-07 -================== - - * Fix select with context in Cheerio function (@jugglinmike) - * Remove unecessary DOM maintenance logic (@jugglinmike) - * Deprecate support for node 0.6 - -0.13.0 / 2013-12-30 -================== - - * Remove "root" node (@jugglinmike) - * Fix bug in `prevAll`, `prev`, `nextAll`, `next`, `prevUntil`, `nextUntil` (@jugglinmike) - * Fix `replaceWith` method (@jugglinmike) - * added nextUntil() and prevUntil() (@finspin) - * Remove internal `connect` function (@jugglinmike) - * Rename `Cheerio#make` to document private status (@jugginmike) - * Remove extraneous call to `_.uniq` (@jugglinmike) - * Use CSSselect library directly (@jugglinmike) - * Run CI against Node v0.11 as an allowed failure (@jugginmike) - * Correct bug in `Cheerio#parents` (@jugglinmike) - * Implement `$.fn.end` (@jugginmike) - * Ignore colons inside of url(.*) when parsing css (@Meekohi) - * Introduce rudimentary benchmark suite (@jugglinmike) - * Update HtmlParser2 version (@jugglinmike) - * Correct inconsistency in `$.fn.map` (@jugglinmike) - * fixed traversing tests (@finspin) - * Simplify `make` method (@jugglinmike) - * Avoid shadowing instance methods from arrays (@jugglinmike) - -0.12.4 / 2013-11-12 -================== - - * Coerce JSON values returned by `data` (@jugglinmike) - * issue #284: when rendering HTML, use original data attributes (@Trott) - * Introduce JSHint for automated code linting (@jugglinmike) - * Prevent `find` from returning duplicate elements (@jugglinmike) - * Implement function signature of `replaceWith` (@jugglinmike) - * Implement function signature of `before` (@jugglinmike) - * Implement function signature of `after` (@jugglinmike) - * Implement function signature of `append`/`prepend` (@jugglinmike) - * Extend iteration methods to accept nodes (@jugglinmike) - * Improve `removeClass` (@jugglinmike) - * Complete function signature of `addClass` (@jugglinmike) - * Fix bug in `removeClass` (@jugglinmike) - * Improve contributing.md (@jugglinmike) - * Fix and document .css() (@jugglinmike) - -0.12.3 / 2013-10-04 -=================== - - * Add .toggleClass() function (@cyberthom) - * Add contributing guidelines (@jugglinmike) - * Fix bug in `siblings` (@jugglinmike) - * Correct the implementation `filter` and `is` (@jugglinmike) - * add .data() function (@andi-neck) - * add .css() (@yields) - * Implements contents() (@jlep) - -0.12.2 / 2013-09-04 -================== - - * Correct implementation of `$.fn.text` (@jugglinmike) - * Refactor Cheerio array creation (@jugglinmike) - * Extend manipulation methods to accept Arrays (@jugglinmike) - * support .attr(attributeName, function(index, attr)) (@xiaohwan) - -0.12.1 / 2013-07-30 -================== - - * Correct behavior of `Cheerio#parents` (@jugglinmike) - * Double quotes inside attributes kills HTML (@khoomeister) - * Making next({}) and prev({}) return empty object (@absentTelegraph) - * Implement $.parseHTML (@jugglinmike) - * Correct bug in jQuery.fn.closest (@jugglinmike) - * Correct behavior of $.fn.val on 'option' elements (@jugglinmike) - -0.12.0 / 2013-06-09 -=================== - - * Breaking Change: Changed context from parent to the actual passed one (@swissmanu) - * Fixed: jquery checkbox val behavior (@jhubble) - * Added: output xml with $.xml() (@Maciek416) - * Bumped: htmlparser2 to 3.1.1 - * Fixed: bug in attr(key, val) on empty objects (@farhadi) - * Added: prevAll, nextAll (@lessmind) - * Fixed: Safety check in parents and closest (@zero21xxx) - * Added: .is(sel) (@zero21xxx) - -0.11.0 / 2013-04-22 -================== - -* Added: .closest() (@jeremy-dentel) -* Added: .parents() (@zero21xxx) -* Added: .val() (@rschmukler & @leahciMic) -* Added: Travis support for node 0.10.0 (@jeremy-dentel) -* Fixed: .find() if no selector (@davidchambers) -* Fixed: Propagate syntax errors caused by invalid selectors (@davidchambers) - -0.10.8 / 2013-03-11 -================== - -* Add slice method (SBoudrias) - -0.10.7 / 2013-02-10 -================== - -* Code & doc cleanup (davidchambers) -* Fixed bug in filter (jugglinmike) - -0.10.6 / 2013-01-29 -================== - -* Added `$.contains(...)` (jugglinmike) -* formatting cleanup (davidchambers) -* Bug fix for `.children()` (jugglinmike & davidchambers) -* Remove global `render` bug (wvl) - -0.10.5 / 2012-12-18 -=================== - -* Fixed botched publish from 0.10.4 - changes should now be present - -0.10.4 / 2012-12-16 -================== - -* $.find should query descendants only (@jugglinmike) -* Tighter underscore dependency - -0.10.3 / 2012-11-18 -=================== - -* fixed outer html bug -* Updated documentation for $(...).html() and $.html() - -0.10.2 / 2012-11-17 -=================== - -* Added a toString() method (@bensheldon) -* use `_.each` and `_.map` to simplify cheerio namesakes (@davidchambers) -* Added filter() with tests and updated readme (@bensheldon & @davidchambers) -* Added spaces between attributes rewritten by removeClass (@jos3000) -* updated docs to remove reference to size method (@ironchefpython) -* removed tidy from cheerio - -0.10.1 / 2012-10-04 -=================== - -* Fixed regression, filtering with a context (#106) - -0.10.0 / 2012-09-24 -=================== - -* Greatly simplified and reorganized the library, reducing the loc by 30% -* Now supports mocha's test-coverage -* Deprecated self-closing tags (HTML5 doesn't require them) -* Fixed error thrown in removeClass(...) @robashton - -0.9.2 / 2012-08-10 -================== - -* added $(...).map(fn) -* manipulation: refactor `makeCheerioArray` -* make .removeClass() remove *all* occurrences (#64) - -0.9.1 / 2012-08-03 -================== - -* fixed bug causing options not to make it to the parser - -0.9.0 / 2012-07-24 -================== - -* Added node 8.x support -* Removed node 4.x support -* Add html(dom) support (@wvl) -* fixed xss vulnerabilities on .attr(), .text(), & .html() (@benatkin, @FB55) -* Rewrote tests into javascript, removing coffeescript dependency (@davidchambers) -* Tons of cleanup (@davidchambers) - -0.8.3 / 2012-06-12 -================== - -* Fixed minor package regression (closes #60) - -0.8.2 / 2012-06-11 -================== - -* Now fails gracefully in cases that involve special chars, which is inline with jQuery (closes #59) -* text() now decode special entities (closes #52) -* updated travis.yml to test node 4.x - -0.8.1 / 2012-06-02 -================== - -* fixed regression where if you created an element, it would update the root -* compatible with node 4.x (again) - -0.8.0 / 2012-05-27 -================== - -* Updated CSS parser to use FB55/CSSselect. Cheerio now supports most CSS3 psuedo selectors thanks to @FB55. -* ignoreWhitespace now on by default again. See #55 for context. -* Changed $(':root') to $.root(), cleaned up $.clone() -* Support for .eq(i) thanks to @alexbardas -* Removed support for node 0.4.x -* Fixed memory leak where package.json was continually loaded -* Tons more tests - -0.7.0 / 2012-04-08 -================== - -* Now testing with node v0.7.7 -* Added travis-ci integration -* Replaced should.js with expect.js. Browser testing to come -* Fixed spacing between attributes and their values -* Added HTML pretty print -* Exposed node-htmlparser2 parsing options -* Revert .replaceWith(...) to be consistent with jQuery - -0.6.2 / 2012-02-12 -================== - -* Fixed .replaceWith(...) regression - -0.6.1 / 2012-02-12 -================== - -* Added .first(), .last(), and .clone() commands. -* Option to parse using whitespace added to `.load`. -* Many bug fixes to make cheerio more aligned with jQuery. -* Added $(':root') to select the highest level element. - -Many thanks to the contributors that made this release happen: @ironchefpython and @siddMahen - -0.6.0 / 2012-02-07 -================== - -* *Important:* `$(...).html()` now returns inner HTML, which is in line with the jQuery spec -* `$.html()` returns the full HTML string. `$.html([cheerioObject])` will return the outer(selected element's tag) and inner HTML of that object -* Fixed bug that prevented HTML strings with depth (eg. `append('
    ')`) from getting `parent`, `next`, `prev` attributes. -* Halted [htmlparser2](https://github.com/FB55/node-htmlparser) at v2.2.2 until single attributes bug gets fixed. - -0.5.1 / 2012-02-05 -================== - -* Fixed minor regression: $(...).text(fn) would fail - -0.5.1 / 2012-02-05 -================== - -* Fixed regression: HTML pages with comments would fail - -0.5.0 / 2012-02-04 -================== - -* Transitioned from Coffeescript back to Javascript -* Parser now ignores whitespace -* Fixed issue with double slashes on self-enclosing tags -* Added boolean attributes to html rendering - -0.4.2 / 2012-01-16 -================== - -* Multiple selectors support: $('.apple, .orange'). Thanks @siddMahen! -* Update package.json to always use latest cheerio-soupselect -* Fix memory leak in index.js - -0.4.1 / 2011-12-19 -================== -* Minor packaging changes to allow `make test` to work from npm installation - -0.4.0 / 2011-12-19 -================== - -* Rewrote all unit tests as cheerio transitioned from vows -> mocha -* Internally, renderer.render -> render(...), parser.parse -> parse(...) -* Append, prepend, html, before, after all work with only text (no tags) -* Bugfix: Attributes can now be removed from script and style tags -* Added yield as a single tag -* Cheerio now compatible with node >=0.4.7 - -0.3.2 / 2011-12-1 -================= - -* Fixed $(...).text(...) to work with "root" element - -0.3.1 / 2011-11-25 -================== - -* Now relying on cheerio-soupselect instead of node-soupselect -* Removed all lingering htmlparser dependencies -* parser now returns parent "root" element. Root now never needs to be updated when there is multiple roots. This fixes ongoing issues with before(...), after(...) and other manipulation functions -* Added jQuery's $(...).replaceWith(...) - -0.3.0 / 2011-11-19 -================== - -* Now using htmlparser2 for parsing (2x speed increase, cleaner, actively developed) -* Added benchmark directory for future speed tests -* $('...').dom() was funky, so it was removed in favor of $('...').get(). $.dom() still works the same. -* $.root now correctly static across all instances of $ -* Added a screencast - -0.2.2 / 2011-11-9 -================= - -* Traversing will select ` - - - - jQuery() | jQuery API Documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - -
    - - - - -
    - -
    -
    - -
    -
    -

    jQuery()

    -
    - -
    - -
    - Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.

    -jQuery( selector [, context ] )Returns: jQuery -

    -
    -

    Description: Accepts a string containing a CSS selector which is then used to match a set of elements.

    - -
    -

    In the first formulation listed above, jQuery() — which can also be written as $() — searches through the DOM for any elements that match the provided selector and creates a new jQuery object that references these elements:

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( "div.foo" );
    -
    -
    - -

    If no elements match the provided selector, the new jQuery object is "empty"; that is, it contains no elements and has .length property of 0.

    -

    Selector Context

    -

    By default, selectors perform their searches within the DOM starting at the document root. However, an alternate context can be given for the search by using the optional second parameter to the $() function. For example, to do a search within an event handler, the search can be restricted like so:

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    -
    $( "div.foo" ).click(function() {
    $( "span", this ).addClass( "bar" );
    });
    -
    -
    - -

    When the search for the span selector is restricted to the context of this, only spans within the clicked element will get the additional class.

    -

    Internally, selector context is implemented with the .find() method, so $( "span", this ) is equivalent to $( this ).find( "span" ).

    - -

    Using DOM elements

    -

    The second and third formulations of this function create a jQuery object using one or more DOM elements that were already selected in some other way.

    -

    Note: These formulations are meant to consume only DOM elements; feeding mixed data to the elementArray form is particularly discouraged.

    -

    A common use of this facility is to call jQuery methods on an element that has been passed to a callback function through the keyword this:

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    -
    $( "div.foo" ).click(function() {
    $( this ).slideUp();
    });
    -
    -
    - -

    This example causes elements to be hidden with a sliding animation when clicked. Because the handler receives the clicked item in the this keyword as a bare DOM element, the element must be passed to the $() function before applying jQuery methods to it.

    -

    XML data returned from an Ajax call can be passed to the $() function so individual elements of the XML structure can be retrieved using .find() and other DOM traversal methods.

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    -
    $.post( "url.xml", function( data ) {
    var $child = $( data ).find( "child" );
    });
    -
    -
    - - -

    Cloning jQuery Objects

    -

    When a jQuery object is passed to the $() function, a clone of the object is created. This new jQuery object references the same DOM elements as the initial one.

    - -

    Returning an Empty Set

    -

    As of jQuery 1.4, calling the jQuery() method with no arguments returns an empty jQuery set (with a .length property of 0). In previous versions of jQuery, this would return a set containing the document node.

    -

    Working With Plain Objects

    -

    At present, the only operations supported on plain JavaScript objects wrapped in jQuery are: .data(),.prop(),.on(), .off(), .trigger() and .triggerHandler(). The use of .data() (or any method requiring .data()) on a plain object will result in a new property on the object called jQuery{randomNumber} (eg. jQuery123456789).

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    4
    - -
    5
    - -
    6
    - -
    7
    - -
    8
    - -
    9
    - -
    10
    - -
    11
    - -
    12
    - -
    13
    - -
    14
    - -
    15
    - -
    16
    - -
    17
    - -
    18
    - -
    19
    - -
    20
    - -
    21
    - -
    22
    - -
    23
    - -
    -
    // Define a plain object
    var foo = { foo: "bar", hello: "world" };
    // Pass it to the jQuery function
    var $foo = $( foo );
    // Test accessing property values
    var test1 = $foo.prop( "foo" ); // bar
    // Test setting property values
    $foo.prop( "foo", "foobar" );
    var test2 = $foo.prop( "foo" ); // foobar
    // Test using .data() as summarized above
    $foo.data( "keyName", "someValue" );
    console.log( $foo ); // will now contain a jQuery{randomNumber} property
    // Test binding an event name and triggering
    $foo.on( "eventName", function () {
    console.log( "eventName was called" );
    });
    $foo.trigger( "eventName" ); // Logs "eventName was called"
    -
    -
    - -

    Should .trigger( "eventName" ) be used, it will search for an "eventName" property on the object and attempt to execute it after any attached jQuery handlers are executed. It does not check whether the property is a function or not. To avoid this behavior, .triggerHandler( "eventName" ) should be used instead.

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $foo.triggerHandler( "eventName" ); // Also logs "eventName was called"
    -
    -
    - -
    -

    Examples:

    -

    Example: Find all p elements that are children of a div element and apply a border to them. -

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    4
    - -
    5
    - -
    6
    - -
    7
    - -
    8
    - -
    9
    - -
    10
    - -
    11
    - -
    12
    - -
    13
    - -
    14
    - -
    15
    - -
    16
    - -
    17
    - -
    18
    - -
    19
    - -
    -
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery demo</title>
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    </head>
    <body>
    <p>one</p>
    <div><p>two</p></div>
    <p>three</p>
    <script>
    $( "div > p" ).css( "border", "1px solid gray" );
    </script>
    </body>
    </html>
    -
    -
    - -

    Demo:

    -
    -
    -
    -

    Example: Find all inputs of type radio within the first form in the document. -

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( "input:radio", document.forms[ 0 ] );
    -
    -
    - -
    -
    -

    Example: Find all div elements within an XML document from an Ajax response. -

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( "div", xml.responseXML );
    -
    -
    - -
    -
    -

    Example: Set the background color of the page to black. -

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( document.body ).css( "background", "black" );
    -
    -
    - -
    -
    -

    Example: Hide all the input elements within a form. -

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( myForm.elements ).hide();
    -
    -
    - -
    -

    -jQuery( html [, ownerDocument ] )Returns: jQuery -

    -
    -

    Description: Creates DOM elements on the fly from the provided string of raw HTML.

    -
      -
    • -

      -version added: 1.0jQuery( html [, ownerDocument ] ) -

      -
        -
      • -
        html
        -
        Type: htmlString -
        -
        A string of HTML to create on the fly. Note that this parses HTML, not XML.
        -
      • -
      • -
        ownerDocument
        -
        Type: document -
        -
        A document in which the new elements will be created.
        -
      • -
      -
    • -
    • -

      -version added: 1.4jQuery( html, attributes ) -

      -
        -
      • -
        html
        -
        Type: htmlString -
        -
        A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>).
        -
      • -
      • -
        attributes
        -
        Type: PlainObject -
        -
        An object of attributes, events, and methods to call on the newly-created element.
        -
      • -
      -
    • -
    -
    -

    Creating New Elements

    -

    If a string is passed as the parameter to $(), jQuery examines the string to see if it looks like HTML (i.e., it starts with <tag ... >). If not, the string is interpreted as a selector expression, as explained above. But if the string appears to be an HTML snippet, jQuery attempts to create new DOM elements as described by the HTML. Then a jQuery object is created and returned that refers to these elements. You can perform any of the usual jQuery methods on this object:

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( "<p id='test'>My <em>new</em> text</p>" ).appendTo( "body" );
    -
    -
    - -

    For explicit parsing of a string to HTML, use the $.parseHTML() method.

    -

    By default, elements are created with an ownerDocument matching the document into which the jQuery library was loaded. Elements being injected into a different document should be created using that document, e.g., $("<p>hello iframe</p>", $("#myiframe").prop("contentWindow").document).

    -

    If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's innerHTML mechanism. In most cases, jQuery creates a new <div> element and sets the innerHTML property of the element to the HTML snippet that was passed in. When the parameter has a single tag (with optional closing tag or quick-closing) — $( "<img />" ) or $( "<img>" ), $( "<a></a>" ) or $( "<a>" ) — jQuery creates the element using the native JavaScript createElement() function.

    -

    When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, jQuery uses the browser"s .innerHTML property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as <html>, <title>, or <head> elements. As a result, the elements inserted may not be representative of the original string passed.

    -

    Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also convert all href properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.

    -

    To ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag:

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( "<a href='http://jquery.com'></a>" );
    -
    -
    - -

    Tags that cannot contain elements may be quick-closed or not:

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    -
    $( "<img>" );
    $( "<input>" );
    -
    -
    - -

    When passing HTML to jQuery(), please also note that text nodes are not treated as DOM elements. With the exception of a few methods (such as .content()), they are generally otherwise ignored or removed. E.g:

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    -
    var el = $( "1<br>2<br>3" ); // returns [<br>, "2", <br>]
    el = $( "1<br>2<br>3 >" ); // returns [<br>, "2", <br>, "3 &gt;"]
    -
    -
    - -

    This behavior is expected.

    -

    As of jQuery 1.4, the second argument to jQuery() can accept a plain object consisting of a superset of the properties that can be passed to the .attr() method.

    -

    Important: If the second argument is passed, the HTML string in the first argument must represent a a simple element with no attributes. As of jQuery 1.4, any event type can be passed in, and the following jQuery methods can be called: val, css, html, text, data, width, height, or offset.

    -

    As of jQuery 1.8, any jQuery instance method (a method of jQuery.fn) can be used as a property of the object passed to the second parameter:

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    4
    - -
    5
    - -
    6
    - -
    7
    - -
    8
    - -
    -
    $( "<div></div>", {
    "class": "my-div",
    on: {
    touchstart: function( event ) {
    // Do something
    }
    }
    }).appendTo( "body" );
    -
    -
    - -

    The name "class" must be quoted in the object since it is a JavaScript reserved word, and "className" cannot be used since it refers to the DOM property, not the attribute.

    -

    While the second argument is convenient, its flexibility can lead to unintended consequences (e.g. $( "<input>", {size: "4"} ) calling the .size() method instead of setting the size attribute). The previous code block could thus be written instead as:

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    4
    - -
    5
    - -
    6
    - -
    7
    - -
    8
    - -
    -
    $( "<div></div>" )
    .addClass( "my-div" )
    .on({
    touchstart: function( event ) {
    // Do something
    }
    })
    .appendTo( "body" );
    -
    -
    - -
    -

    Examples:

    -

    Example: Create a div element (and all of its contents) dynamically and append it to the body element. Internally, an element is created and its innerHTML property set to the given markup. -

    -
    - - - - - - - -
    - -
    1
    - -
    -
    $( "<div><p>Hello</p></div>" ).appendTo( "body" )
    -
    -
    - -
    -
    -

    Example: Create some DOM elements. -

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    4
    - -
    5
    - -
    6
    - -
    7
    - -
    8
    - -
    -
    $( "<div/>", {
    "class": "test",
    text: "Click me!",
    click: function() {
    $( this ).toggleClass( "test" );
    }
    })
    .appendTo( "body" );
    -
    -
    - -
    -

    -jQuery( callback )Returns: jQuery -

    -
    -

    Description: Binds a function to be executed when the DOM has finished loading.

    - -
    -

    This function behaves just like $( document ).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready. While this function is, technically, chainable, there really isn"t much use for chaining against it.

    -
    -

    Examples:

    -

    Example: Execute the function when the DOM is ready to be used. -

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    -
    $(function() {
    // Document is ready
    });
    -
    -
    - -
    -
    -

    Example: Use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias. -

    -
    - - - - - - - -
    - -
    1
    - -
    2
    - -
    3
    - -
    -
    jQuery(function( $ ) {
    // Your code using failsafe $ alias here...
    });
    -
    -
    - -
    -
    - -
    -
    - - -
    -
    -
    - - - - - - - - - - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/benchmark/jquery-2.0.3.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/benchmark/jquery-2.0.3.js deleted file mode 100644 index ebc6c187..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/benchmark/jquery-2.0.3.js +++ /dev/null @@ -1,8829 +0,0 @@ -/*! - * jQuery JavaScript Library v2.0.3 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-07-03T13:30Z - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // A central reference to the root jQuery(document) - rootjQuery, - - // The deferred used on DOM ready - readyList, - - // Support: IE9 - // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - location = window.location, - document = window.document, - docElem = document.documentElement, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "2.0.3", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler and self cleanup method - completed = function() { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - jQuery.ready(); - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray, - - isWindow: function( obj ) { - return obj != null && obj === obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - // Support: Safari <= 5.1 (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - // Not plain objects: - // - Any object or value whose internal [[Class]] property is not "[object Object]" - // - DOM nodes - // - window - if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - // Support: Firefox <20 - // The try/catch suppresses exceptions thrown when attempting to access - // the "constructor" property of certain host objects, ie. |window.location| - // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 - try { - if ( obj.constructor && - !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { - return false; - } - } catch ( e ) { - return false; - } - - // If the function hasn't returned already, we're confident that - // |obj| is a plain object, created by {} or constructed with new Object - return true; - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - - if ( scripts ) { - jQuery( scripts ).remove(); - } - - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: JSON.parse, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE9 - try { - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - globalEval: function( code ) { - var script, - indirect = eval; - - code = jQuery.trim( code ); - - if ( code ) { - // If the code includes a valid, prologue position - // strict mode pragma, execute code by injecting a - // script tag into the document. - if ( code.indexOf("use strict") === 1 ) { - script = document.createElement("script"); - script.text = code; - document.head.appendChild( script ).parentNode.removeChild( script ); - } else { - // Otherwise, avoid the DOM node creation, insertion - // and removal by using an indirect global eval - indirect( code ); - } - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - trim: function( text ) { - return text == null ? "" : core_trim.call( text ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : core_indexOf.call( arr, elem, i ); - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: Date.now, - - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - } else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -/*! - * Sizzle CSS Selector Engine v1.9.4-pre - * http://sizzlejs.com/ - * - * Copyright 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-06-03 - */ -(function( window, undefined ) { - -var i, - support, - cachedruns, - Expr, - getText, - isXML, - compile, - outermostContext, - sortInput, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - hasDuplicate = false, - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - return 0; - }, - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rsibling = new RegExp( whitespace + "*[+~]" ), - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent.attachEvent && parent !== parent.top ) { - parent.attachEvent( "onbeforeunload", function() { - setDocument(); - }); - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = assert(function( div ) { - div.innerHTML = "
    "; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Support: Opera 10-12/IE8 - // ^= $= *= and empty values - // Should not select anything - // Support: Windows 8 Native Apps - // The type attribute is restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "t", "" ); - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); - - if ( compare ) { - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } - - // Not directly comparable, sort on existence of method - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val === undefined ? - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null : - val; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) - ); - return results; -} - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome<14 -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; - } - }); -} - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function( support ) { - var input = document.createElement("input"), - fragment = document.createDocumentFragment(), - div = document.createElement("div"), - select = document.createElement("select"), - opt = select.appendChild( document.createElement("option") ); - - // Finish early in limited environments - if ( !input.type ) { - return support; - } - - input.type = "checkbox"; - - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere) - support.checkOn = input.value !== ""; - - // Must access the parent to make an option select properly - // Support: IE9, IE10 - support.optSelected = opt.selected; - - // Will be defined later - support.reliableMarginRight = true; - support.boxSizingReliable = true; - support.pixelPosition = false; - - // Make sure checked status is properly cloned - // Support: IE9, IE10 - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Check if an input maintains its value after becoming a radio - // Support: IE9, IE10 - input = document.createElement("input"); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment.appendChild( input ); - - // Support: Safari 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: Firefox, Chrome, Safari - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - support.focusinBubbles = "onfocusin" in window; - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, - // Support: Firefox, Android 2.3 (Prefixed box-sizing versions). - divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box", - body = document.getElementsByTagName("body")[ 0 ]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - // Check box-sizing and margin behavior. - body.appendChild( container ).appendChild( div ); - div.innerHTML = ""; - // Support: Firefox, Android 2.3 (Prefixed box-sizing versions). - div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%"; - - // Workaround failing boxSizing test due to offsetWidth returning wrong value - // with some non-1 values of body zoom, ticket #13543 - jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { - support.boxSizing = div.offsetWidth === 4; - }); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Support: Android 2.3 - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - body.removeChild( container ); - }); - - return support; -})( {} ); - -/* - Implementation Summary - - 1. Enforce API surface and semantic compatibility with 1.9.x branch - 2. Improve the module's maintainability by reducing the storage - paths to a single mechanism. - 3. Use the same single mechanism to support "private" and "user" data. - 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) - 5. Avoid exposing implementation details on user objects (eg. expando properties) - 6. Provide a clear path for implementation upgrade to WeakMap in 2014 -*/ -var data_user, data_priv, - rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function Data() { - // Support: Android < 4, - // Old WebKit does not have Object.preventExtensions/freeze method, - // return new empty object instead with no [[set]] accessor - Object.defineProperty( this.cache = {}, 0, { - get: function() { - return {}; - } - }); - - this.expando = jQuery.expando + Math.random(); -} - -Data.uid = 1; - -Data.accepts = function( owner ) { - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType ? - owner.nodeType === 1 || owner.nodeType === 9 : true; -}; - -Data.prototype = { - key: function( owner ) { - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return the key for a frozen object. - if ( !Data.accepts( owner ) ) { - return 0; - } - - var descriptor = {}, - // Check if the owner object already has a cache key - unlock = owner[ this.expando ]; - - // If not, create one - if ( !unlock ) { - unlock = Data.uid++; - - // Secure it in a non-enumerable, non-writable property - try { - descriptor[ this.expando ] = { value: unlock }; - Object.defineProperties( owner, descriptor ); - - // Support: Android < 4 - // Fallback to a less secure definition - } catch ( e ) { - descriptor[ this.expando ] = unlock; - jQuery.extend( owner, descriptor ); - } - } - - // Ensure the cache object - if ( !this.cache[ unlock ] ) { - this.cache[ unlock ] = {}; - } - - return unlock; - }, - set: function( owner, data, value ) { - var prop, - // There may be an unlock assigned to this node, - // if there is no entry for this "owner", create one inline - // and set the unlock as though an owner entry had always existed - unlock = this.key( owner ), - cache = this.cache[ unlock ]; - - // Handle: [ owner, key, value ] args - if ( typeof data === "string" ) { - cache[ data ] = value; - - // Handle: [ owner, { properties } ] args - } else { - // Fresh assignments by object are shallow copied - if ( jQuery.isEmptyObject( cache ) ) { - jQuery.extend( this.cache[ unlock ], data ); - // Otherwise, copy the properties one-by-one to the cache object - } else { - for ( prop in data ) { - cache[ prop ] = data[ prop ]; - } - } - } - return cache; - }, - get: function( owner, key ) { - // Either a valid cache is found, or will be created. - // New caches will be created and the unlock returned, - // allowing direct access to the newly created - // empty data object. A valid owner object must be provided. - var cache = this.cache[ this.key( owner ) ]; - - return key === undefined ? - cache : cache[ key ]; - }, - access: function( owner, key, value ) { - var stored; - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ((key && typeof key === "string") && value === undefined) ) { - - stored = this.get( owner, key ); - - return stored !== undefined ? - stored : this.get( owner, jQuery.camelCase(key) ); - } - - // [*]When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, name, camel, - unlock = this.key( owner ), - cache = this.cache[ unlock ]; - - if ( key === undefined ) { - this.cache[ unlock ] = {}; - - } else { - // Support array or space separated string of keys - if ( jQuery.isArray( key ) ) { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = key.concat( key.map( jQuery.camelCase ) ); - } else { - camel = jQuery.camelCase( key ); - // Try the string as a key before any manipulation - if ( key in cache ) { - name = [ key, camel ]; - } else { - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - name = camel; - name = name in cache ? - [ name ] : ( name.match( core_rnotwhite ) || [] ); - } - } - - i = name.length; - while ( i-- ) { - delete cache[ name[ i ] ]; - } - } - }, - hasData: function( owner ) { - return !jQuery.isEmptyObject( - this.cache[ owner[ this.expando ] ] || {} - ); - }, - discard: function( owner ) { - if ( owner[ this.expando ] ) { - delete this.cache[ owner[ this.expando ] ]; - } - } -}; - -// These may be used throughout the jQuery core codebase -data_user = new Data(); -data_priv = new Data(); - - -jQuery.extend({ - acceptData: Data.accepts, - - hasData: function( elem ) { - return data_user.hasData( elem ) || data_priv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return data_user.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - data_user.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to data_priv methods, these can be deprecated. - _data: function( elem, name, data ) { - return data_priv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - data_priv.remove( elem, name ); - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - elem = this[ 0 ], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = data_user.get( elem ); - - if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[ i ].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - dataAttr( elem, name, data[ name ] ); - } - } - data_priv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - data_user.set( this, key ); - }); - } - - return jQuery.access( this, function( value ) { - var data, - camelKey = jQuery.camelCase( key ); - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - // Attempt to get data from the cache - // with the key as-is - data = data_user.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to get data from the cache - // with the key camelized - data = data_user.get( elem, camelKey ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, camelKey, undefined ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each(function() { - // First, attempt to store a copy or reference of any - // data that might've been store with a camelCased key. - var data = data_user.get( this, camelKey ); - - // For HTML5 data-* attribute interop, we have to - // store property names with dashes in a camelCase form. - // This might not apply to all properties...* - data_user.set( this, camelKey, value ); - - // *... In the case of properties that might _actually_ - // have dashes, we need to also store a copy of that - // unchanged property. - if ( key.indexOf("-") !== -1 && data !== undefined ) { - data_user.set( this, key, value ); - } - }); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each(function() { - data_user.remove( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? JSON.parse( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - data_user.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = data_priv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray( data ) ) { - queue = data_priv.access( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return data_priv.get( elem, key ) || data_priv.access( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - data_priv.remove( elem, [ type + "queue", key ] ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = data_priv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n\f]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button)$/i; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each(function() { - delete this[ jQuery.propFix[ name ] || name ]; - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value; - - if ( typeof stateVal === "boolean" && type === "string" ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - data_priv.set( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // IE6-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { - optionSet = true; - } - } - - // force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.bool.test( name ) ) { - // Set corresponding property to false - elem[ propName ] = false; - } - - elem.removeAttribute( name ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? - ret : - ( elem[ name ] = value ); - - } else { - return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? - ret : - elem[ name ]; - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? - elem.tabIndex : - -1; - } - } - } -}); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; - - jQuery.expr.attrHandle[ name ] = function( elem, name, isXML ) { - var fn = jQuery.expr.attrHandle[ name ], - ret = isXML ? - undefined : - /* jshint eqeqeq: false */ - // Temporarily disable this handler to check existence - (jQuery.expr.attrHandle[ name ] = undefined) != - getter( elem, name, isXML ) ? - - name.toLowerCase() : - null; - - // Restore handler - jQuery.expr.attrHandle[ name ] = fn; - - return ret; - }; -}); - -// Support: IE9+ -// Selectedness for an option in an optgroup can be inaccurate -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - } - }; -} - -jQuery.each([ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -}); - -// Radios and checkboxes getter/setter -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }; - if ( !jQuery.support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - }; - } -}); -var rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = data_priv.get( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = data_priv.hasData( elem ) && data_priv.get( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - data_priv.remove( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && - jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, j, ret, matched, handleObj, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, matches, sel, handleObj, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.disabled !== true || event.type !== "click" ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: Cordova 2.5 (WebKit) (#13255) - // All events should have a target; Cordova deviceready doesn't - if ( !event.target ) { - event.target = document; - } - - // Support: Safari 6.0+, Chrome < 28 - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - this.focus(); - return false; - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } -}; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && e.preventDefault ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && e.stopPropagation ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -// Support: Chrome 15+ -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// Create "bubbling" focus and blur events -// Support: Firefox, Chrome, Safari -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -var isSimple = /^.[^:#\[\.,]*$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter(function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - pos = ( rneedsContext.test( selectors ) || typeof selectors !== "string" ) ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - cur = matched.push( cur ); - break; - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return core_indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return core_indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return elem.contentDocument || jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.unique( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); - }, - - dir: function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; - }, - - sibling: function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( isSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( core_indexOf.call( qualifier, elem ) >= 0 ) !== not; - }); -} -var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rhtml = /<|&#?\w+;/, - rnoInnerhtml = /<(?:script|style|link)/i, - manipulation_rcheckableType = /^(?:checkbox|radio)$/i, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /^$|\/(?:java|ecma)script/i, - rscriptTypeMasked = /^true\/(.*)/, - rcleanScript = /^\s*\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - - // Support: IE 9 - option: [ 1, "" ], - - thead: [ 1, "", "
    " ], - col: [ 2, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - - _default: [ 0, "", "" ] - }; - -// Support: IE 9 -wrapMap.optgroup = wrapMap.option; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var - // Snapshot the DOM in case .domManip sweeps something relevant into its fragment - args = jQuery.map( this, function( elem ) { - return [ elem.nextSibling, elem.parentNode ]; - }), - i = 0; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - var next = args[ i++ ], - parent = args[ i++ ]; - - if ( parent ) { - // Don't use the snapshot next if it has moved (#13810) - if ( next && next.parentNode !== parent ) { - next = this.nextSibling; - } - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - // Allow new content to include elements from the context set - }, true ); - - // Force removal if there was no new content (e.g., from empty arguments) - return i ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback, allowIntersection ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[ 0 ], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - self.domManip( args, callback, allowIntersection ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - // Support: QtWebKit - // jQuery.merge because core_push.apply(_, arraylike) throws - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery._evalUrl( node.src ); - } else { - jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); - } - } - } - } - } - } - - return this; - } -}); - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: QtWebKit - // .get() because core_push.apply(_, arraylike) throws - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); - - // Support: IE >= 9 - // Fix Cloning issues - if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var elem, tmp, tag, wrap, contains, j, - i = 0, - l = elems.length, - fragment = context.createDocumentFragment(), - nodes = []; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - // Support: QtWebKit - // jQuery.merge because core_push.apply(_, arraylike) throws - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: QtWebKit - // jQuery.merge because core_push.apply(_, arraylike) throws - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Fixes #12346 - // Support: Webkit, IE - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; - }, - - cleanData: function( elems ) { - var data, elem, events, type, key, j, - special = jQuery.event.special, - i = 0; - - for ( ; (elem = elems[ i ]) !== undefined; i++ ) { - if ( Data.accepts( elem ) ) { - key = elem[ data_priv.expando ]; - - if ( key && (data = data_priv.cache[ key ]) ) { - events = Object.keys( data.events || {} ); - if ( events.length ) { - for ( j = 0; (type = events[j]) !== undefined; j++ ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - if ( data_priv.cache[ key ] ) { - // Discard any remaining `private` data - delete data_priv.cache[ key ]; - } - } - } - // Discard any remaining `user` data - delete data_user.cache[ elem[ data_user.expando ] ]; - } - }, - - _evalUrl: function( url ) { - return jQuery.ajax({ - url: url, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } -}); - -// Support: 1.x compatibility -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - - if ( match ) { - elem.type = match[ 1 ]; - } else { - elem.removeAttribute("type"); - } - - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var l = elems.length, - i = 0; - - for ( ; i < l; i++ ) { - data_priv.set( - elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) - ); - } -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( data_priv.hasData( src ) ) { - pdataOld = data_priv.access( src ); - pdataCur = data_priv.set( dest, pdataOld ); - events = pdataOld.events; - - if ( events ) { - delete pdataCur.handle; - pdataCur.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( data_user.hasData( src ) ) { - udataOld = data_user.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - data_user.set( dest, udataCur ); - } -} - - -function getAll( context, tag ) { - var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : - context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : - []; - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], ret ) : - ret; -} - -// Support: IE >= 9 -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} -jQuery.fn.extend({ - wrapAll: function( html ) { - var wrap; - - if ( jQuery.isFunction( html ) ) { - return this.each(function( i ) { - jQuery( this ).wrapAll( html.call(this, i) ); - }); - } - - if ( this[ 0 ] ) { - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function( i ) { - jQuery( this ).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function( i ) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - } -}); -var curCSS, iframe, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -function getStyles( elem ) { - return window.getComputedStyle( elem, null ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = data_priv.get( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = data_priv.access( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each(function() { - if ( isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": "cssFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifying setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - style[ name ] = value; - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - } -}); - -curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // Support: IE9 - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // Support: Safari 5.1 - // A tribute to the "awesome hack by Dean Edwards" - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; -}; - - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery(" - - - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/qwery/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/qwery/index.js deleted file mode 100644 index 345d503d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/qwery/index.js +++ /dev/null @@ -1,549 +0,0 @@ -"use strict"; - -var expect = require("expect.js"), - DomUtils = require("htmlparser2").DomUtils, - helper = require("../tools/helper.js"), - path = require("path"), - document = helper.getDocument(path.join(__dirname, "index.html")), - CSSselect = helper.CSSselect; - -var location = {hash: ""}; -CSSselect.pseudos.target = function(elem){ - return elem.attribs && elem.attribs.id === location.hash.substr(1); -}; - -//--- - -/* - The following is taken from https://github.com/ded/qwery/blob/master/tests/tests.js -*/ - -CSSselect.pseudos.humanoid = function(e) { return CSSselect.is(e, 'li:contains(human)') || CSSselect.is(e, 'ol:contains(human)'); }; - -var frag = helper.getDOM( - '
    ' + - '

    ' + - '
    ' + - '

    ' + - '

    ' + - '

    ' -); - -var doc = helper.getDOM( - '
    ' + - '
    ' + - '

    ' + - '' + - '' + - '
    ' + - '

    ' + - '
    ' + - '
    ' -); - -var el = DomUtils.getElementById('attr-child-boosh', document); - -var pseudos = DomUtils.getElementById('pseudos', document).children.filter(DomUtils.isTag); - -module.exports = { - -'Contexts': { - - 'should be able to pass optional context': function () { - expect(CSSselect('.a', document)).to.have.length(3); //no context found 3 elements (.a) - expect(CSSselect('.a', CSSselect('#boosh', document))).to.have.length(2); //context found 2 elements (#boosh .a) - }, - -/* - 'should be able to pass string as context': function() { - expect(CSSselect('.a', '#boosh')).to.have.length(2); //context found 2 elements(.a, #boosh) - expect(CSSselect('.a', '.a')).to.be.empty(); //context found 0 elements(.a, .a) - expect(CSSselect('.a', '.b')).to.have.length(1); //context found 1 elements(.a, .b) - expect(CSSselect('.a', '#boosh .b')).to.have.length(1); //context found 1 elements(.a, #boosh .b) - expect(CSSselect('.b', '#boosh .b')).to.be.empty(); //context found 0 elements(.b, #boosh .b) - }, -*/ -/* - 'should be able to pass qwery result as context': function() { - expect(CSSselect('.a', CSSselect('#boosh', document))).to.have.length(2); //context found 2 elements(.a, #boosh) - expect(CSSselect('.a', CSSselect('.a', document))).to.be.empty(); //context found 0 elements(.a, .a) - expect(CSSselect('.a', CSSselect('.b', document))).to.have.length(1); //context found 1 elements(.a, .b) - expect(CSSselect('.a', CSSselect('#boosh .b', document))).to.have.length(1); //context found 1 elements(.a, #boosh .b) - expect(CSSselect('.b', CSSselect('#boosh .b', document))).to.be.empty(); //context found 0 elements(.b, #boosh .b) - }, -*/ - 'should not return duplicates from combinators': function () { - expect(CSSselect('#boosh,#boosh', document)).to.have.length(1); //two booshes dont make a thing go right - expect(CSSselect('#boosh,.apples,#boosh', document)).to.have.length(1); //two booshes and an apple dont make a thing go right - }, - - 'byId sub-queries within context': function() { - expect(CSSselect('#booshTest', CSSselect('#boosh', document))).to.have.length(1); //found "#id #id" - expect(CSSselect('.a.b #booshTest', CSSselect('#boosh', document))).to.have.length(1); //found ".class.class #id" - expect(CSSselect('.a>#booshTest', CSSselect('#boosh', document))).to.have.length(1); //found ".class>#id" - expect(CSSselect('>.a>#booshTest', CSSselect('#boosh', document))).to.have.length(1); //found ">.class>#id" - expect(CSSselect('#boosh', CSSselect('#booshTest', document)).length).to.not.be.ok(); //shouldn't find #boosh (ancestor) within #booshTest (descendent) - expect(CSSselect('#boosh', CSSselect('#lonelyBoosh', document)).length).to.not.be.ok(); //shouldn't find #boosh within #lonelyBoosh (unrelated) - } -}, - -'CSS 1': { - 'get element by id': function () { - var result = CSSselect('#boosh', document); - expect(result[0]).to.be.ok(); //found element with id=boosh - expect(CSSselect('h1', document)[0]).to.be.ok(); //found 1 h1 - }, - - 'byId sub-queries': function() { - expect(CSSselect('#boosh #booshTest', document)).to.have.length(1); //found "#id #id" - expect(CSSselect('.a.b #booshTest', document)).to.have.length(1); //found ".class.class #id" - expect(CSSselect('#boosh>.a>#booshTest', document)).to.have.length(1); //found "#id>.class>#id" - expect(CSSselect('.a>#booshTest', document)).to.have.length(1); //found ".class>#id" - }, - - 'get elements by class': function () { - expect(CSSselect('#boosh .a', document)).to.have.length(2); //found two elements - expect(CSSselect('#boosh div.a', document)[0]).to.be.ok(); //found one element - expect(CSSselect('#boosh div', document)).to.have.length(2); //found two {div} elements - expect(CSSselect('#boosh span', document)[0]).to.be.ok(); //found one {span} element - expect(CSSselect('#boosh div div', document)[0]).to.be.ok(); //found a single div - expect(CSSselect('a.odd', document)).to.have.length(1); //found single a - }, - - 'combos': function () { - expect(CSSselect('#boosh div,#boosh span', document)).to.have.length(3); //found 2 divs and 1 span - }, - - 'class with dashes': function() { - expect(CSSselect('.class-with-dashes', document)).to.have.length(1); //found something - }, - - 'should ignore comment nodes': function() { - expect(CSSselect('#boosh *', document)).to.have.length(4); //found only 4 elements under #boosh - }, - - 'deep messy relationships': function() { - // these are mostly characterised by a combination of tight relationships and loose relationships - // on the right side of the query it's easy to find matches but they tighten up quickly as you - // go to the left - // they are useful for making sure the dom crawler doesn't stop short or over-extend as it works - // up the tree the crawl needs to be comprehensive - expect(CSSselect('div#fixtures > div a', document)).to.have.length(5); //found four results for "div#fixtures > div a" - expect(CSSselect('.direct-descend > .direct-descend .lvl2', document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend .lvl2" - expect(CSSselect('.direct-descend > .direct-descend div', document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend div" - expect(CSSselect('.direct-descend > .direct-descend div', document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend div" - expect(CSSselect('div#fixtures div ~ a div', document)).to.be.empty(); //found no results for odd query - expect(CSSselect('.direct-descend > .direct-descend > .direct-descend ~ .lvl2', document)).to.be.empty(); //found no results for another odd query - } -}, - -'CSS 2': { - - 'get elements by attribute': function () { - var wanted = CSSselect('#boosh div[test]', document)[0]; - var expected = DomUtils.getElementById('booshTest', document); - expect(wanted).to.be(expected); //found attribute - expect(CSSselect('#boosh div[test=fg]', document)[0]).to.be(expected); //found attribute with value - expect(CSSselect('em[rel~="copyright"]', document)).to.have.length(1); //found em[rel~="copyright"] - expect(CSSselect('em[nopass~="copyright"]', document)).to.be.empty(); //found em[nopass~="copyright"] - }, - - 'should not throw error by attribute selector': function () { - expect(CSSselect('[foo^="bar"]', document)).to.have.length(1); //found 1 element - }, - - 'crazy town': function () { - var el = DomUtils.getElementById('attr-test3', document); - expect(CSSselect('div#attr-test3.found.you[title="whatup duders"]', document)[0]).to.be(el); //found the right element - } - -}, - -'attribute selectors': { - - /* CSS 2 SPEC */ - - '[attr]': function () { - var expected = DomUtils.getElementById('attr-test-1', document); - expect(CSSselect('#attributes div[unique-test]', document)[0]).to.be(expected); //found attribute with [attr] - }, - - '[attr=val]': function () { - var expected = DomUtils.getElementById('attr-test-2', document); - expect(CSSselect('#attributes div[test="two-foo"]', document)[0]).to.be(expected); //found attribute with = - expect(CSSselect("#attributes div[test='two-foo']", document)[0]).to.be(expected); //found attribute with = - expect(CSSselect('#attributes div[test=two-foo]', document)[0]).to.be(expected); //found attribute with = - }, - - '[attr~=val]': function () { - var expected = DomUtils.getElementById('attr-test-3', document); - expect(CSSselect('#attributes div[test~=three]', document)[0]).to.be(expected); //found attribute with ~= - }, - - '[attr|=val]': function () { - var expected = DomUtils.getElementById('attr-test-2', document); - expect(CSSselect('#attributes div[test|="two-foo"]', document)[0]).to.be(expected); //found attribute with |= - expect(CSSselect('#attributes div[test|=two]', document)[0]).to.be(expected); //found attribute with |= - }, - - '[href=#x] special case': function () { - var expected = DomUtils.getElementById('attr-test-4', document); - expect(CSSselect('#attributes a[href="#aname"]', document)[0]).to.be(expected); //found attribute with href=#x - }, - - /* CSS 3 SPEC */ - - '[attr^=val]': function () { - var expected = DomUtils.getElementById('attr-test-2', document); - expect(CSSselect('#attributes div[test^=two]', document)[0]).to.be(expected); //found attribute with ^= - }, - - '[attr$=val]': function () { - var expected = DomUtils.getElementById('attr-test-2', document); - expect(CSSselect('#attributes div[test$=foo]', document)[0]).to.be(expected); //found attribute with $= - }, - - '[attr*=val]': function () { - var expected = DomUtils.getElementById('attr-test-3', document); - expect(CSSselect('#attributes div[test*=hree]', document)[0]).to.be(expected); //found attribute with *= - }, - - 'direct descendants': function () { - expect(CSSselect('#direct-descend > .direct-descend', document)).to.have.length(2); //found two direct descendents - expect(CSSselect('#direct-descend > .direct-descend > .lvl2', document)).to.have.length(3); //found three second-level direct descendents - }, - - 'sibling elements': function () { - expect(CSSselect('#sibling-selector ~ .sibling-selector', document)).to.have.length(2); //found two siblings - expect(CSSselect('#sibling-selector ~ div.sibling-selector', document)).to.have.length(2); //found two siblings - expect(CSSselect('#sibling-selector + div.sibling-selector', document)).to.have.length(1); //found one sibling - expect(CSSselect('#sibling-selector + .sibling-selector', document)).to.have.length(1); //found one sibling - - expect(CSSselect('.parent .oldest ~ .sibling', document)).to.have.length(4); //found four younger siblings - expect(CSSselect('.parent .middle ~ .sibling', document)).to.have.length(2); //found two younger siblings - expect(CSSselect('.parent .middle ~ h4', document)).to.have.length(1); //found next sibling by tag - expect(CSSselect('.parent .middle ~ h4.younger', document)).to.have.length(1); //found next sibling by tag and class - expect(CSSselect('.parent .middle ~ h3', document)).to.be.empty(); //an element can't be its own sibling - expect(CSSselect('.parent .middle ~ h2', document)).to.be.empty(); //didn't find an older sibling - expect(CSSselect('.parent .youngest ~ .sibling', document)).to.be.empty(); //found no younger siblings - - expect(CSSselect('.parent .oldest + .sibling', document)).to.have.length(1); //found next sibling - expect(CSSselect('.parent .middle + .sibling', document)).to.have.length(1); //found next sibling - expect(CSSselect('.parent .middle + h4', document)).to.have.length(1); //found next sibling by tag - expect(CSSselect('.parent .middle + h3', document)).to.be.empty(); //an element can't be its own sibling - expect(CSSselect('.parent .middle + h2', document)).to.be.empty(); //didn't find an older sibling - expect(CSSselect('.parent .youngest + .sibling', document)).to.be.empty(); //found no younger siblings - } - -}, - -/* -'Uniq': { - 'duplicates arent found in arrays': function () { - expect(CSSselect.uniq(['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e'])).to.have.length(5); //result should be a, b, c, d, e - expect(CSSselect.uniq(['a', 'b', 'c', 'c', 'c'])).to.have.length(3); //result should be a, b, c - } -}, -*/ - - -'element-context queries': { - -/* - 'relationship-first queries': function() { - expect(CSSselect('> .direct-descend', CSSselect('#direct-descend', document))).to.have.length(2); //found two direct descendents using > first - expect(CSSselect('~ .sibling-selector', CSSselect('#sibling-selector', document))).to.have.length(2); //found two siblings with ~ first - expect(CSSselect('+ .sibling-selector', CSSselect('#sibling-selector', document))).to.have.length(1); //found one sibling with + first - expect(CSSselect('> .tokens a', CSSselect('.idless', document)[0])).to.have.length(1); //found one sibling from a root with no id - }, -*/ - - // should be able to query on an element that hasn't been inserted into the dom - 'detached fragments': function() { - expect(CSSselect('.a span', frag)).to.have.length(1); //should find child elements of fragment - //expect(CSSselect('> div p em', frag)).to.have.length(2); //should find child elements of fragment, relationship first - }, - - 'byId sub-queries within detached fragment': function () { - expect(CSSselect('#emem', frag)).to.have.length(1); //found "#id" in fragment - expect(CSSselect('.d.i #emem', frag)).to.have.length(1); //found ".class.class #id" in fragment - expect(CSSselect('.d #oooo #emem', frag)).to.have.length(1); //found ".class #id #id" in fragment - //expect(CSSselect('> div #oooo', frag)).to.have.length(1); //found "> .class #id" in fragment - expect(CSSselect('#oooo', CSSselect('#emem', frag)).length).to.not.be.ok(); //shouldn't find #oooo (ancestor) within #emem (descendent) - expect(CSSselect('#sep', CSSselect('#emem', frag)).length).to.not.be.ok(); //shouldn't find #sep within #emem (unrelated) - }, - -/* - 'exclude self in match': function() { - expect(CSSselect('.order-matters', CSSselect('#order-matters', document))).to.have.length(4); //should not include self in element-context queries - }, -*/ - - // because form's have .length - 'forms can be used as contexts': function() { - expect(CSSselect('*', CSSselect('form', document)[0])).to.have.length(3); //found 3 elements under <form> - } -}, - -'tokenizer': { - - 'should not get weird tokens': function () { - expect(CSSselect('div .tokens[title="one"]', document)[0]).to.be(DomUtils.getElementById('token-one', document)); //found div .tokens[title="one"] - expect(CSSselect('div .tokens[title="one two"]', document)[0]).to.be(DomUtils.getElementById('token-two', document)); //found div .tokens[title="one two"] - expect(CSSselect('div .tokens[title="one two three #%"]', document)[0]).to.be(DomUtils.getElementById('token-three', document)); //found div .tokens[title="one two three #%"] - expect(CSSselect("div .tokens[title='one two three #%'] a", document)[0]).to.be(DomUtils.getElementById('token-four', document)); //found div .tokens[title=\'one two three #%\'] a - expect(CSSselect('div .tokens[title="one two three #%"] a[href$=foo] div', document)[0]).to.be(DomUtils.getElementById('token-five', document)); //found div .tokens[title="one two three #%"] a[href=foo] div - } - -}, - -'interesting syntaxes': { - 'should parse bad selectors': function () { - expect(CSSselect('#spaced-tokens p em a', document).length).to.be.ok(); //found element with funny tokens - } -}, - -'order matters': { - - //
    - //

    - // - // - // - //
    - - 'the order of elements return matters': function () { - function tag(el) { - return el.name.toLowerCase(); - } - var els = CSSselect('#order-matters .order-matters', document); - expect(tag(els[0])).to.be('p'); //first element matched is a {p} tag - expect(tag(els[1])).to.be('a'); //first element matched is a {a} tag - expect(tag(els[2])).to.be('em'); //first element matched is a {em} tag - expect(tag(els[3])).to.be('b'); //first element matched is a {b} tag - } - -}, - -'pseudo-selectors': { - ':contains': function() { - expect(CSSselect('li:contains(humans)', document)).to.have.length(1); //found by "element:contains(text)" - expect(CSSselect(':contains(humans)', document)).to.have.length(5); //found by ":contains(text)", including all ancestors - // * is an important case, can cause weird errors - expect(CSSselect('*:contains(humans)', document)).to.have.length(5); //found by "*:contains(text)", including all ancestors - expect(CSSselect('ol:contains(humans)', document)).to.have.length(1); //found by "ancestor:contains(text)" - }, - - ':not': function() { - expect(CSSselect('.odd:not(div)', document)).to.have.length(1); //found one .odd :not an <a> - }, - - ':first-child': function () { - expect(CSSselect('#pseudos div:first-child', document)[0]).to.be(pseudos[0]); //found first child - expect(CSSselect('#pseudos div:first-child', document)).to.have.length(1); //found only 1 - }, - - ':last-child': function () { - var all = DomUtils.getElementsByTagName('div', pseudos); - expect(CSSselect('#pseudos div:last-child', document)[0]).to.be(all[all.length - 1]); //found last child - expect(CSSselect('#pseudos div:last-child', document)).to.have.length(1); //found only 1 - }, - - 'ol > li[attr="boosh"]:last-child': function () { - var expected = DomUtils.getElementById('attr-child-boosh', document); - expect(CSSselect('ol > li[attr="boosh"]:last-child', document)).to.have.length(1); //only 1 element found - expect(CSSselect('ol > li[attr="boosh"]:last-child', document)[0]).to.be(expected); //found correct element - }, - - ':nth-child(odd|even|x)': function () { - var second = DomUtils.getElementsByTagName('div', pseudos)[1]; - expect(CSSselect('#pseudos :nth-child(odd)', document)).to.have.length(4); //found 4 odd elements - expect(CSSselect('#pseudos div:nth-child(odd)', document)).to.have.length(3); //found 3 odd elements with div tag - expect(CSSselect('#pseudos div:nth-child(even)', document)).to.have.length(3); //found 3 even elements with div tag - expect(CSSselect('#pseudos div:nth-child(2)', document)[0]).to.be(second); //found 2nd nth-child of pseudos - }, - - ':nth-child(expr)': function () { - var fifth = DomUtils.getElementsByTagName('a', pseudos)[0]; - var sixth = DomUtils.getElementsByTagName('div', pseudos)[4]; - - expect(CSSselect('#pseudos :nth-child(3n+1)', document)).to.have.length(3); //found 3 elements - expect(CSSselect('#pseudos :nth-child(+3n-2)', document)).to.have.length(3); //found 3 elements' - expect(CSSselect('#pseudos :nth-child(-n+6)', document)).to.have.length(6); //found 6 elements - expect(CSSselect('#pseudos :nth-child(-n+5)', document)).to.have.length(5); //found 5 elements - expect(CSSselect('#pseudos :nth-child(3n+2)', document)[1]).to.be(fifth); //second :nth-child(3n+2) is the fifth child - expect(CSSselect('#pseudos :nth-child(3n)', document)[1]).to.be(sixth); //second :nth-child(3n) is the sixth child - }, - - ':nth-last-child(odd|even|x)': function () { - var second = DomUtils.getElementsByTagName('div', pseudos)[1]; - expect(CSSselect('#pseudos :nth-last-child(odd)', document)).to.have.length(4); //found 4 odd elements - expect(CSSselect('#pseudos div:nth-last-child(odd)', document)).to.have.length(3); //found 3 odd elements with div tag - expect(CSSselect('#pseudos div:nth-last-child(even)', document)).to.have.length(3); //found 3 even elements with div tag - expect(CSSselect('#pseudos div:nth-last-child(6)', document)[0]).to.be(second); //6th nth-last-child should be 2nd of 7 elements - }, - - ':nth-last-child(expr)': function () { - var third = DomUtils.getElementsByTagName('div', pseudos)[2]; - - expect(CSSselect('#pseudos :nth-last-child(3n+1)', document)).to.have.length(3); //found 3 elements - expect(CSSselect('#pseudos :nth-last-child(3n-2)', document)).to.have.length(3); //found 3 elements - expect(CSSselect('#pseudos :nth-last-child(-n+6)', document)).to.have.length(6); //found 6 elements - expect(CSSselect('#pseudos :nth-last-child(-n+5)', document)).to.have.length(5); //found 5 elements - expect(CSSselect('#pseudos :nth-last-child(3n+2)', document)[0]).to.be(third); //first :nth-last-child(3n+2) is the third child - }, - - ':nth-of-type(expr)': function () { - var a = DomUtils.getElementsByTagName('a', pseudos)[0]; - - expect(CSSselect('#pseudos div:nth-of-type(3n+1)', document)).to.have.length(2); //found 2 div elements - expect(CSSselect('#pseudos a:nth-of-type(3n+1)', document)).to.have.length(1); //found 1 a element - expect(CSSselect('#pseudos a:nth-of-type(3n+1)', document)[0]).to.be(a); //found the right a element - expect(CSSselect('#pseudos a:nth-of-type(3n)', document)).to.be.empty(); //no matches for every third a - expect(CSSselect('#pseudos a:nth-of-type(odd)', document)).to.have.length(1); //found the odd a - expect(CSSselect('#pseudos a:nth-of-type(1)', document)).to.have.length(1); //found the first a - }, - - ':nth-last-of-type(expr)': function () { - var second = DomUtils.getElementsByTagName('div', pseudos)[1]; - - expect(CSSselect('#pseudos div:nth-last-of-type(3n+1)', document)).to.have.length(2); //found 2 div elements - expect(CSSselect('#pseudos a:nth-last-of-type(3n+1)', document)).to.have.length(1); //found 1 a element - expect(CSSselect('#pseudos div:nth-last-of-type(5)', document)[0]).to.be(second); //5th nth-last-of-type should be 2nd of 7 elements - }, - - ':first-of-type': function () { - expect(CSSselect('#pseudos a:first-of-type', document)[0]).to.be(DomUtils.getElementsByTagName('a', pseudos)[0]); //found first a element - expect(CSSselect('#pseudos a:first-of-type', document)).to.have.length(1); //found only 1 - }, - - ':last-of-type': function () { - var all = DomUtils.getElementsByTagName('div', pseudos); - expect(CSSselect('#pseudos div:last-of-type', document)[0]).to.be(all[all.length - 1]); //found last div element - expect(CSSselect('#pseudos div:last-of-type', document)).to.have.length(1); //found only 1 - }, - - ':only-of-type': function () { - expect(CSSselect('#pseudos a:only-of-type', document)[0]).to.be(DomUtils.getElementsByTagName('a', pseudos)[0]); //found the only a element - expect(CSSselect('#pseudos a:first-of-type', document)).to.have.length(1); //found only 1 - }, - - ':target': function () { - location.hash = ''; - expect(CSSselect('#pseudos:target', document)).to.be.empty(); //#pseudos is not the target - location.hash = '#pseudos'; - expect(CSSselect('#pseudos:target', document)).to.have.length(1); //now #pseudos is the target - location.hash = ''; - }, - - 'custom pseudos': function() { - // :humanoid implemented just for testing purposes - expect(CSSselect(':humanoid', document)).to.have.length(2); //selected using custom pseudo - } - -}, - -/* -'argument types': { - - 'should be able to pass in nodes as arguments': function () { - var el = DomUtils.getElementById('boosh', document); - expect(CSSselect(el)[0]).to.be(el); //CSSselect(el)[0] == el - expect(CSSselect(el, 'body')[0]).to.be(el); //CSSselect(el, 'body')[0] == el - expect(CSSselect(el, document)[0]).to.be(el); //CSSselect(el, document)[0] == el - expect(CSSselect(window)[0]).to.be(window); //CSSselect(window)[0] == window - expect(CSSselect(document)[0]).to.be(document); //CSSselect(document)[0] == document - }, - - 'should be able to pass in an array of results as arguments': function () { - var el = DomUtils.getElementById('boosh', document); - var result = CSSselect([CSSselect('#boosh', document), CSSselect(document), CSSselect(window)]); - expect(result).to.have.length(3); //3 elements in the combined set - expect(result[0]).to.be(el); //result[0] == el - expect(result[1]).to.be(document); //result[0] == document - expect(result[2]).to.be(window); //result[0] == window - expect(CSSselect([CSSselect('#pseudos div.odd', document), CSSselect('#pseudos div.even', document)])).to.have.length(6); //found all the odd and even divs - } - -}, -*/ - -'is()': { - 'simple selectors': function () { - expect(CSSselect.is(el, 'li')).to.be.ok(); //tag - expect(CSSselect.is(el, '*')).to.be.ok(); //wildcard - expect(CSSselect.is(el, '#attr-child-boosh')).to.be.ok(); //#id - expect(CSSselect.is(el, '[attr]')).to.be.ok(); //[attr] - expect(CSSselect.is(el, '[attr=boosh]')).to.be.ok(); //[attr=val] - expect(CSSselect.is(el, 'div')).to.not.be.ok(); //wrong tag - expect(CSSselect.is(el, '#foo')).to.not.be.ok(); //wrong #id - expect(CSSselect.is(el, '[foo]')).to.not.be.ok(); //wrong [attr] - expect(CSSselect.is(el, '[attr=foo]')).to.not.be.ok(); //wrong [attr=val] - }, - 'selector sequences': function () { - expect(CSSselect.is(el, 'li#attr-child-boosh[attr=boosh]')).to.be.ok(); //tag#id[attr=val] - expect(CSSselect.is(el, 'div#attr-child-boosh[attr=boosh]')).to.not.be.ok(); //wrong tag#id[attr=val] - }, - 'selector sequences combinators': function () { - expect(CSSselect.is(el, 'ol li')).to.be.ok(); //tag tag - expect(CSSselect.is(el, 'ol>li')).to.be.ok(); //tag>tag - expect(CSSselect.is(el, 'ol>li+li')).to.be.ok(); //tab>tag+tag - expect(CSSselect.is(el, 'ol#list li#attr-child-boosh[attr=boosh]')).to.be.ok(); //tag#id tag#id[attr=val] - expect(CSSselect.is(el, 'ol#list>li#attr-child-boosh[attr=boosh]')).to.not.be.ok(); //wrong tag#id>tag#id[attr=val] - expect(CSSselect.is(el, 'ol ol li#attr-child-boosh[attr=boosh]')).to.be.ok(); //tag tag tag#id[attr=val] - expect(CSSselect.is(CSSselect('#token-four', document)[0], 'div#fixtures>div a')).to.be.ok(); //tag#id>tag tag where ambiguous middle tag requires backtracking - }, - 'pseudos': function() { - //TODO: more tests! - expect(CSSselect.is(el, 'li:contains(hello)')).to.be.ok(); //matching :contains(text) - expect(CSSselect.is(el, 'li:contains(human)')).to.not.be.ok(); //non-matching :contains(text) - expect(CSSselect.is(CSSselect('#list>li', document)[2], ':humanoid')).to.be.ok(); //matching custom pseudo - expect(CSSselect.is(CSSselect('#list>li', document)[1], ':humanoid')).to.not.be.ok(); //non-matching custom pseudo - }/*, - 'context': function () { - expect(CSSselect.is(el, 'li#attr-child-boosh[attr=boosh]', CSSselect('#list', document)[0])).to.be.ok(); //context - expect(CSSselect.is(el, 'ol#list li#attr-child-boosh[attr=boosh]', CSSselect('#boosh', document)[0])).to.not.be.ok(); //wrong context - }*/ -}, - -'selecting elements in other documents': { - 'get element by id': function () { - var result = CSSselect('#hsoob', doc); - expect(result[0]).to.be.ok(); //found element with id=hsoob - }, - - 'get elements by class': function () { - expect(CSSselect('#hsoob .a', doc)).to.have.length(2); //found two elements - expect(CSSselect('#hsoob div.a', doc)[0]).to.be.ok(); //found one element - expect(CSSselect('#hsoob div', doc)).to.have.length(2); //found two {div} elements - expect(CSSselect('#hsoob span', doc)[0]).to.be.ok(); //found one {span} element - expect(CSSselect('#hsoob div div', doc)[0]).to.be.ok(); //found a single div - expect(CSSselect('p.odd', doc)).to.have.length(1); //found single br - }, - - 'complex selectors': function () { - expect(CSSselect('.d ~ .sib', doc)).to.have.length(2); //found one ~ sibling - expect(CSSselect('.a .d + .sib', doc)).to.have.length(1); //found 2 + siblings - expect(CSSselect('#hsoob > div > .h', doc)).to.have.length(1); //found span using child selectors - expect(CSSselect('.a .d ~ .sib[test="f g"]', doc)).to.have.length(1); //found 1 ~ sibling with test attribute - }, - - 'byId sub-queries': function () { - expect(CSSselect('#hsoob #spanny', doc)).to.have.length(1); //found "#id #id" in frame - expect(CSSselect('.a #spanny', doc)).to.have.length(1); //found ".class #id" in frame - expect(CSSselect('.a #booshTest #spanny', doc)).to.have.length(1); //found ".class #id #id" in frame - //expect(CSSselect('> #hsoob', doc)).to.have.length(1) //found "> #id" in frame - }, - - 'byId sub-queries within sub-context': function () { - expect(CSSselect('#spanny', CSSselect('#hsoob', doc))).to.have.length(1); //found "#id -> #id" in frame - expect(CSSselect('.a #spanny', CSSselect('#hsoob', doc))).to.have.length(1); //found ".class #id" in frame - expect(CSSselect('.a #booshTest #spanny', CSSselect('#hsoob', doc))).to.have.length(1); //found ".class #id #id" in frame - expect(CSSselect('.a > #booshTest', CSSselect('#hsoob', doc))).to.have.length(1); //found "> .class #id" in frame - expect(CSSselect('#booshTest', CSSselect('#spanny', doc)).length).to.not.be.ok(); //shouldn't find #booshTest (ancestor) within #spanny (descendent) - expect(CSSselect('#booshTest', CSSselect('#lonelyHsoob', doc)).length).to.not.be.ok(); //shouldn't find #booshTest within #lonelyHsoob (unrelated) - } - -} - -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/sizzle/selector.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/sizzle/selector.js deleted file mode 100644 index b7de5162..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/sizzle/selector.js +++ /dev/null @@ -1,1211 +0,0 @@ -var DomUtils = require("domutils"), - helper = require("../tools/helper.js"), - CSSselect = helper.CSSselect, - assert = require("assert"), - equal = assert.equal, - deepEqual = assert.deepEqual, - ok = assert.ok, - testInit = require("./data/testinit.js"), - q = testInit.q, - t = testInit.t, - document = testInit.loadDoc(), - createWithFriesXML = testInit.createWithFriesXML; - -function Sizzle(str, doc){ - return CSSselect(str, doc || document); -} - -function jQuery(dom){ - if(typeof dom === "string") dom = helper.getDOM(dom); - var ret = { - appendTo: function(elem){ - if(typeof elem === "string") elem = Sizzle(elem)[0]; - dom.forEach(function(child){ - DomUtils.appendChild(elem, child); - }); - return this; - }, - remove: function(){ - dom.forEach(DomUtils.removeElement); - return this; - }, - prev: function(){ - dom = dom.map(function(elem){ - return elem.prev; - }); - return this; - }, - before: function(str){ - dom.forEach(function(elem){ - helper.getDOM(str).forEach(function(child){ - DomUtils.prepend(elem, child); - }); - }); - return this; - } - }; - - dom.forEach(function(elem, i){ - ret[i] = elem; - }); - - return ret; -} - -Sizzle.matches = function(selector, elements){ - return elements.filter(CSSselect.compile(selector)); -}; - -Sizzle.matchesSelector = CSSselect.is; - -function noop(){} - -var expect = noop; - -var raises = assert.throws; - -function asyncTest(name, _, func){ - it(name, func); -} - -//add an `appendTo` method to cheerio -jQuery.prototype.appendTo = function(elem){ - if(typeof elem === "string") elem = Sizzle(elem)[0]; - Array.prototype.push.apply(elem.children, this); - this.each(function(i, child){ - child.parent = elem; - }); - return this; -}; - -var test = it; - -beforeEach(function(){ - document = testInit.loadDoc(); -}); - -// #### NOTE: #### -// jQuery should not be used in this module -// except for DOM manipulation -// If jQuery is mandatory for the selection, move the test to jquery/test/unit/selector.js -// Use t() or Sizzle() -// ############### - -/* - ======== QUnit Reference ======== - http://docs.jquery.com/QUnit - - Test methods: - expect(numAssertions) - stop() - start() - note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite - so that start and stop can be passed as callbacks without worrying about - their parameters - Test assertions: - ok(value, [message]) - equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - raises(block, [expected], [message]) - - ======== testinit.js reference ======== - See data/testinit.js - - q(...); - Returns an array of elements with the given IDs - @example q("main", "foo", "bar") => [
    , , ] - - t( testName, selector, [ "array", "of", "ids" ] ); - Asserts that a select matches the given IDs - @example t("Check for something", "//[a]", ["foo", "baar"]); - - url( "some/url.php" ); - Add random number to url to stop caching - @example url("data/test.html") => "data/test.html?10538358428943" - @example url("data/test.php?foo=bar") => "data/test.php?foo=bar&10538358345554" -*/ - -test("element", function() { - expect( 38 ); - - var form, all, good, i, obj1, lengthtest, - siblingTest, iframe, iframeDoc, html; - - equal( Sizzle("").length, 0, "Empty selector returns an empty array" ); - deepEqual( Sizzle("div", document.createTextNode("")), [], "Text element as context fails silently" ); - form = document.getElementById("form"); - ok( !Sizzle.matchesSelector( form, "" ), "Empty string passed to matchesSelector does not match" ); - equal( Sizzle(" ").length, 0, "Empty selector returns an empty array" ); - equal( Sizzle("\t").length, 0, "Empty selector returns an empty array" ); - - ok( Sizzle("*").length >= 30, "Select all" ); - all = Sizzle("*"); - good = true; - for ( i = 0; i < all.length; i++ ) { - if ( all[i].nodeType === 8 ) { - good = false; - } - } - ok( good, "Select all elements, no comment nodes" ); - t( "Element Selector", "html", ["html"] ); - t( "Element Selector", "body", ["body"] ); - t( "Element Selector", "#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] ); - - t( "Leading space", " #qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] ); - t( "Leading tab", "\t#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] ); - t( "Leading carriage return", "\r#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] ); - t( "Leading line feed", "\n#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] ); - t( "Leading form feed", "\f#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] ); - t( "Trailing space", "#qunit-fixture p ", ["firstp","ap","sndp","en","sap","first"] ); - t( "Trailing tab", "#qunit-fixture p\t", ["firstp","ap","sndp","en","sap","first"] ); - t( "Trailing carriage return", "#qunit-fixture p\r", ["firstp","ap","sndp","en","sap","first"] ); - t( "Trailing line feed", "#qunit-fixture p\n", ["firstp","ap","sndp","en","sap","first"] ); - t( "Trailing form feed", "#qunit-fixture p\f", ["firstp","ap","sndp","en","sap","first"] ); - - t( "Parent Element", "dl ol", ["empty", "listWithTabIndex"] ); - t( "Parent Element (non-space descendant combinator)", "dl\tol", ["empty", "listWithTabIndex"] ); - obj1 = document.getElementById("object1"); - equal( Sizzle("param", obj1).length, 2, "Object/param as context" ); - - deepEqual( Sizzle("select", form), q("select1","select2","select3","select4","select5"), "Finding selects with a context." ); - - // Check for unique-ness and sort order - deepEqual( Sizzle("p, div p"), Sizzle("p"), "Check for duplicates: p, div p" ); - - t( "Checking sort order", "h2, h1", ["qunit-header", "qunit-banner", "qunit-userAgent"] ); - // t( "Checking sort order", "h2:first, h1:first", ["qunit-header", "qunit-banner"] ); - t( "Checking sort order", "#qunit-fixture p, #qunit-fixture p a", ["firstp", "simon1", "ap", "google", "groups", "anchor1", "mark", "sndp", "en", "yahoo", "sap", "anchor2", "simon", "first"] ); - - // Test Conflict ID - lengthtest = document.getElementById("lengthtest"); - deepEqual( Sizzle("#idTest", lengthtest), q("idTest"), "Finding element with id of ID." ); - deepEqual( Sizzle("[name='id']", lengthtest), q("idTest"), "Finding element with id of ID." ); - deepEqual( Sizzle("input[id='idTest']", lengthtest), q("idTest"), "Finding elements with id of ID." ); - - siblingTest = document.getElementById("siblingTest"); // TODO - // deepEqual( Sizzle("div em", siblingTest), [], "Element-rooted QSA does not select based on document context" ); - // deepEqual( Sizzle("div em, div em, div em:not(div em)", siblingTest), [], "Element-rooted QSA does not select based on document context" ); - // deepEqual( Sizzle("div em, em\\,", siblingTest), [], "Escaped commas do not get treated with an id in element-rooted QSA" ); - - iframe = document.getElementById("iframe"); - //iframeDoc.open(); - iframe.children = helper.getDOM("

    bar

    "); - //iframeDoc.close(); - deepEqual( - Sizzle( "p:contains(bar)", iframe ), - [ DomUtils.getElementById("foo", iframe.children) ], - "Other document as context" - ); - iframe.children = []; - - html = ""; - for ( i = 0; i < 100; i++ ) { - html = "
    " + html + "
    "; - } - html = jQuery( html ).appendTo( document.body ); - ok( !!Sizzle("body div div div").length, "No stack or performance problems with large amounts of descendents" ); - ok( !!Sizzle("body>div div div").length, "No stack or performance problems with large amounts of descendents" ); - html.remove(); - - // Real use case would be using .watch in browsers with window.watch (see Issue #157) - var elem = document.createElement("tostring"); - elem.attribs.id = "toString"; - var siblings = q("qunit-fixture")[0].children; - siblings.push( elem ); - t( "Element name matches Object.prototype property", "tostring#toString", ["toString"] ); - siblings.pop(); -}); - -test("XML Document Selectors", function() { - var xml = createWithFriesXML(); - expect( 11 ); - - equal( Sizzle("foo_bar", xml).length, 1, "Element Selector with underscore" ); - equal( Sizzle(".component", xml).length, 1, "Class selector" ); - equal( Sizzle("[class*=component]", xml).length, 1, "Attribute selector for class" ); - equal( Sizzle("property[name=prop2]", xml).length, 1, "Attribute selector with name" ); - equal( Sizzle("[name=prop2]", xml).length, 1, "Attribute selector with name" ); - equal( Sizzle("#seite1", xml).length, 1, "Attribute selector with ID" ); - equal( Sizzle("component#seite1", xml).length, 1, "Attribute selector with ID" ); - equal( Sizzle.matches( "#seite1", Sizzle("component", xml) ).length, 1, "Attribute selector filter with ID" ); - equal( Sizzle("meta property thing", xml).length, 2, "Descendent selector and dir caching" ); - ok( Sizzle.matchesSelector( xml.lastChild, "soap\\:Envelope", { xmlMode: true } ), "Check for namespaced element" ); - - xml = helper.getDOM("", { xmlMode: true }); - equal( Sizzle( "elem:not(:has(*))", xml ).length, 1, - "Non-qSA path correctly handles numeric ids (jQuery #14142)" ); -}); - -test("broken", function() { - expect( 26 ); - - var attrbad, - broken = function( name, selector ) { - raises(function() { - // Setting context to null here somehow avoids QUnit's window.error handling - // making the e & e.message correct - // For whatever reason, without this, - // Sizzle.error will be called but no error will be seen in oldIE - Sizzle.call( null, selector ); - }, SyntaxError, name + ": " + selector ); - }; - - // broken( "Broken Selector", "[" ); - // broken( "Broken Selector", "(" ); - // broken( "Broken Selector", "{" ); - // broken( "Broken Selector", "<" ); - // broken( "Broken Selector", "()" ); - // broken( "Broken Selector", "<>" ); - broken( "Broken Selector", "{}" ); - broken( "Broken Selector", "," ); - broken( "Broken Selector", ",a" ); - broken( "Broken Selector", "a," ); - // Hangs on IE 9 if regular expression is inefficient - // broken( "Broken Selector", "[id=012345678901234567890123456789"); - broken( "Doesn't exist", ":visble" ); - broken( "Nth-child", ":nth-child" ); - // Sigh again. IE 9 thinks this is also a real selector - // not super critical that we fix this case - broken( "Nth-child", ":nth-child(-)" ); - // Sigh. WebKit thinks this is a real selector in qSA - // They've already fixed this and it'll be coming into - // current browsers soon. Currently, Safari 5.0 still has this problem - broken( "Nth-child", ":nth-child(asdf)", [] ); - broken( "Nth-child", ":nth-child(2n+-0)" ); - broken( "Nth-child", ":nth-child(2+0)" ); - broken( "Nth-child", ":nth-child(- 1n)" ); - broken( "Nth-child", ":nth-child(-1 n)" ); - broken( "First-child", ":first-child(n)" ); - broken( "Last-child", ":last-child(n)" ); - broken( "Only-child", ":only-child(n)" ); - broken( "Nth-last-last-child", ":nth-last-last-child(1)" ); - broken( "First-last-child", ":first-last-child" ); - broken( "Last-last-child", ":last-last-child" ); - broken( "Only-last-child", ":only-last-child" ); - - // Make sure attribute value quoting works correctly. See: #6093 - attrbad = jQuery("").appendTo("#qunit-fixture"); - - // broken( "Attribute not escaped", "input[name=foo.baz]", [] ); - // Shouldn't be matching those inner brackets - // broken( "Attribute not escaped", "input[name=foo[baz]]", [] ); -}); - -test("id", function() { - expect( 34 ); - - var fiddle, a; - - t( "ID Selector", "#body", ["body"] ); - t( "ID Selector w/ Element", "body#body", ["body"] ); - t( "ID Selector w/ Element", "ul#first", [] ); - t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] ); - t( "ID selector with non-existant descendant", "#firstp #foobar", [] ); - t( "ID selector using UTF8", "#台北Táiběi", ["台北Táiběi"] ); - t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] ); - t( "Descendant ID selector using UTF8", "div #台北", ["台北"] ); - t( "Child ID selector using UTF8", "form > #台北", ["台北"] ); - - t( "Escaped ID", "#foo\\:bar", ["foo:bar"] ); - t( "Escaped ID with descendent", "#foo\\:bar span:not(:input)", ["foo_descendent"] ); - t( "Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - t( "Descendant escaped ID", "div #foo\\:bar", ["foo:bar"] ); - t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] ); - t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - - fiddle = jQuery("
    ").appendTo("#qunit-fixture"); - // deepEqual( Sizzle( "> span", Sizzle("#fiddle\\\\Foo")[0] ), q([ "fiddleSpan" ]), "Escaped ID as context" ); - fiddle.remove(); - - t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267 - t( "ID Selector, not an ancestor ID", "#form #first", [] ); - t( "ID Selector, not a child ID", "#form > #option1a", [] ); - - t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] ); - t( "All Children of ID with no children", "#firstUL > *", [] ); - - equal( Sizzle("#tName1")[0].attribs.id, "tName1", "ID selector with same value for a name attribute" ); - t( "ID selector non-existing but name attribute on an A tag", "#tName2", [] ); - t( "Leading ID selector non-existing but name attribute on an A tag", "#tName2 span", [] ); - t( "Leading ID selector existing, retrieving the child", "#tName1 span", ["tName1-span"] ); - equal( Sizzle("div > div #tName1")[0].attribs.id, Sizzle("#tName1-span")[0].parent.attribs.id, "Ending with ID" ); - - a = jQuery("").appendTo("#qunit-fixture"); - t( "ID Selector contains backslash", "#backslash\\\\foo", ["backslash\\foo"] ); - - t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] ); - - t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986 - - deepEqual( Sizzle("div#form", document.body), [], "ID selector within the context of another element" ); - - t( "Underscore ID", "#types_all", ["types_all"] ); - t( "Dash ID", "#qunit-fixture", ["qunit-fixture"] ); - - t( "ID with weird characters in it", "#name\\+value", ["name+value"] ); -}); - -test("class", function() { - expect( 26 ); - - t( "Class Selector", ".blog", ["mark","simon"] ); - t( "Class Selector", ".GROUPS", ["groups"] ); - t( "Class Selector", ".blog.link", ["simon"] ); - t( "Class Selector w/ Element", "a.blog", ["mark","simon"] ); - t( "Parent Class Selector", "p .blog", ["mark","simon"] ); - - t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] ); - t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] ); - t( "Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"] ); - t( "Class selector using UTF8", ".台北Táiběi, .台北", ["utf8class1","utf8class2"] ); - t( "Descendant class selector using UTF8", "div .台北Táiběi", ["utf8class1"] ); - t( "Child class selector using UTF8", "form > .台北Táiběi", ["utf8class1"] ); - - t( "Escaped Class", ".foo\\:bar", ["foo:bar"] ); - t( "Escaped Class", ".test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - t( "Descendant escaped Class", "div .foo\\:bar", ["foo:bar"] ); - t( "Descendant escaped Class", "div .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - t( "Child escaped Class", "form > .foo\\:bar", ["foo:bar"] ); - t( "Child escaped Class", "form > .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - - var div = document.createElement("div"); - div.children = helper.getDOM("
    "); - div.children.forEach(function(e){ - e.parent = div; - }); - deepEqual( Sizzle(".e", div), [ div.children[0] ], "Finding a second class." ); - - var lastChild = div.children[div.children.length - 1]; - lastChild.attribs.class = "e"; - - deepEqual( Sizzle(".e", div), [ div.children[0], lastChild ], "Finding a modified class." ); - - ok( !Sizzle.matchesSelector( div, ".null"), ".null does not match an element with no class" ); - ok( !Sizzle.matchesSelector( div.children[0], ".null div"), ".null does not match an element with no class" ); - div.attribs.class = "null"; - ok( Sizzle.matchesSelector( div, ".null"), ".null matches element with class 'null'" ); - ok( Sizzle.matchesSelector( div.children[0], ".null div"), "caching system respects DOM changes" ); - ok( !Sizzle.matchesSelector( document, ".foo" ), "testing class on document doesn't error" ); - //ok( !Sizzle.matchesSelector( window, ".foo" ), "testing class on window doesn't error" ); - - lastChild.attribs.class += " hasOwnProperty toString"; - deepEqual( Sizzle(".e.hasOwnProperty.toString", div), [ lastChild ], "Classes match Object.prototype properties" ); - - div = jQuery("
    ")[0]; - equal( Sizzle(".foo", div).length, 1, "Class selector against SVG" ); -}); - -test("name", function() { - expect( 13 ); - - var form; - - t( "Name selector", "input[name=action]", ["text1"] ); - t( "Name selector with single quotes", "input[name='action']", ["text1"] ); - t( "Name selector with double quotes", "input[name=\"action\"]", ["text1"] ); - - t( "Name selector non-input", "[name=example]", ["name-is-example"] ); - t( "Name selector non-input", "[name=div]", ["name-is-div"] ); - t( "Name selector non-input", "*[name=iframe]", ["iframe"] ); - - t( "Name selector for grouped input", "input[name='types[]']", ["types_all", "types_anime", "types_movie"] ); - - form = document.getElementById("form"); - deepEqual( Sizzle("input[name=action]", form), q("text1"), "Name selector within the context of another element" ); - deepEqual( Sizzle("input[name='foo[bar]']", form), q("hidden2"), "Name selector for grouped form element within the context of another element" ); - - form = jQuery("
    ").appendTo("body"); - equal( Sizzle("input", form[0]).length, 1, "Make sure that rooted queries on forms (with possible expandos) work." ); - - form.remove(); - - t( "Find elements that have similar IDs", "[name=tName1]", ["tName1ID"] ); - t( "Find elements that have similar IDs", "[name=tName2]", ["tName2ID"] ); - t( "Find elements that have similar IDs", "#tName2ID", ["tName2ID"] ); -}); - -test("multiple", function() { - expect(6); - - t( "Comma Support", "h2, #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] ); - t( "Comma Support", "h2 , #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] ); - t( "Comma Support", "h2 , #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] ); - t( "Comma Support", "h2,#qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] ); - t( "Comma Support", "h2,#qunit-fixture p ", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] ); - t( "Comma Support", "h2\t,\r#qunit-fixture p\n", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] ); -}); - -test("child and adjacent", function() { - expect( 42 ); - - var siblingFirst, en, nothiddendiv; - - t( "Child", "p > a", ["simon1","google","groups","mark","yahoo","simon"] ); - t( "Child", "p> a", ["simon1","google","groups","mark","yahoo","simon"] ); - t( "Child", "p >a", ["simon1","google","groups","mark","yahoo","simon"] ); - t( "Child", "p>a", ["simon1","google","groups","mark","yahoo","simon"] ); - t( "Child w/ Class", "p > a.blog", ["mark","simon"] ); - t( "All Children", "code > *", ["anchor1","anchor2"] ); - t( "All Grandchildren", "p > * > *", ["anchor1","anchor2"] ); - t( "Adjacent", "#qunit-fixture a + a", ["groups", "tName2ID"] ); - t( "Adjacent", "#qunit-fixture a +a", ["groups", "tName2ID"] ); - t( "Adjacent", "#qunit-fixture a+ a", ["groups", "tName2ID"] ); - t( "Adjacent", "#qunit-fixture a+a", ["groups", "tName2ID"] ); - t( "Adjacent", "p + p", ["ap","en","sap"] ); - t( "Adjacent", "p#firstp + p", ["ap"] ); - t( "Adjacent", "p[lang=en] + p", ["sap"] ); - t( "Adjacent", "a.GROUPS + code + a", ["mark"] ); - t( "Comma, Child, and Adjacent", "#qunit-fixture a + a, code > a", ["groups","anchor1","anchor2","tName2ID"] ); - t( "Element Preceded By", "#qunit-fixture p ~ div", ["foo", "nothiddendiv", "moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"] ); - t( "Element Preceded By", "#first ~ div", ["moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"] ); - t( "Element Preceded By", "#groups ~ a", ["mark"] ); - t( "Element Preceded By", "#length ~ input", ["idTest"] ); - t( "Element Preceded By", "#siblingfirst ~ em", ["siblingnext", "siblingthird"] ); - t( "Element Preceded By (multiple)", "#siblingTest em ~ em ~ em ~ span", ["siblingspan"] ); - t( "Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", ["siblingfirst"] ); - - siblingFirst = document.getElementById("siblingfirst"); - - //deepEqual( Sizzle("~ em", siblingFirst), q("siblingnext", "siblingthird"), "Element Preceded By with a context." ); - //deepEqual( Sizzle("+ em", siblingFirst), q("siblingnext"), "Element Directly Preceded By with a context." ); - //deepEqual( Sizzle("~ em:first", siblingFirst), q("siblingnext"), "Element Preceded By positional with a context." ); - - en = document.getElementById("en"); - //deepEqual( Sizzle("+ p, a", en), q("yahoo", "sap"), "Compound selector with context, beginning with sibling test." ); - //deepEqual( Sizzle("a, + p", en), q("yahoo", "sap"), "Compound selector with context, containing sibling test." ); - - t( "Multiple combinators selects all levels", "#siblingTest em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"] ); - t( "Multiple combinators selects all levels", "#siblingTest > em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"] ); - t( "Multiple sibling combinators doesn't miss general siblings", "#siblingTest > em:first-child + em ~ span", ["siblingspan"] ); - t( "Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", [] ); - - equal( Sizzle("#listWithTabIndex").length, 1, "Parent div for next test is found via ID (#8310)" ); - //equal( Sizzle("#listWithTabIndex li:eq(2) ~ li").length, 1, "Find by general sibling combinator (#8310)" ); - equal( Sizzle("#__sizzle__").length, 0, "Make sure the temporary id assigned by sizzle is cleared out (#8310)" ); - equal( Sizzle("#listWithTabIndex").length, 1, "Parent div for previous test is still found via ID (#8310)" ); - - t( "Verify deep class selector", "div.blah > p > a", [] ); - - t( "No element deep selector", "div.foo > span > a", [] ); - - nothiddendiv = document.getElementById("nothiddendiv"); - //deepEqual( Sizzle("> :first", nothiddendiv), q("nothiddendivchild"), "Verify child context positional selector" ); - //deepEqual( Sizzle("> :eq(0)", nothiddendiv), q("nothiddendivchild"), "Verify child context positional selector" ); - //deepEqual( Sizzle("> *:first", nothiddendiv), q("nothiddendivchild"), "Verify child context positional selector" ); - - t( "Non-existant ancestors", ".fototab > .thumbnails > a", [] ); -}); - -test("attributes", function() { - expect( 76 ); - - var opt, input, attrbad, div; - - t( "Attribute Exists", "#qunit-fixture a[title]", ["google"] ); - t( "Attribute Exists (case-insensitive)", "#qunit-fixture a[TITLE]", ["google"] ); - t( "Attribute Exists", "#qunit-fixture *[title]", ["google"] ); - t( "Attribute Exists", "#qunit-fixture [title]", ["google"] ); - t( "Attribute Exists", "#qunit-fixture a[ title ]", ["google"] ); - - t( "Boolean attribute exists", "#select2 option[selected]", ["option2d"]); - t( "Boolean attribute equals", "#select2 option[selected='selected']", ["option2d"]); - - t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", ["simon1"] ); - t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", ["simon1"] ); - t( "Attribute Equals", "#qunit-fixture a[rel=bookmark]", ["simon1"] ); - t( "Attribute Equals", "#qunit-fixture a[href='http://www.google.com/']", ["google"] ); - t( "Attribute Equals", "#qunit-fixture a[ rel = 'bookmark' ]", ["simon1"] ); - t( "Attribute Equals Number", "#qunit-fixture option[value=1]", ["option1b","option2b","option3b","option4b","option5c"] ); - t( "Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", ["foodWithNegativeTabIndex"] ); - - document.getElementById("anchor2").href = "#2"; - t( "href Attribute", "p a[href^=#]", ["anchor2"] ); - t( "href Attribute", "p a[href*=#]", ["simon1", "anchor2"] ); - - t( "for Attribute", "form label[for]", ["label-for"] ); - t( "for Attribute in form", "#form [for=action]", ["label-for"] ); - - t( "Attribute containing []", "input[name^='foo[']", ["hidden2"] ); - t( "Attribute containing []", "input[name^='foo[bar]']", ["hidden2"] ); - t( "Attribute containing []", "input[name*='[bar]']", ["hidden2"] ); - t( "Attribute containing []", "input[name$='bar]']", ["hidden2"] ); - t( "Attribute containing []", "input[name$='[bar]']", ["hidden2"] ); - t( "Attribute containing []", "input[name$='foo[bar]']", ["hidden2"] ); - t( "Attribute containing []", "input[name*='foo[bar]']", ["hidden2"] ); - - deepEqual( Sizzle( "input[data-comma='0,1']" ), [ document.getElementById("el12087") ], "Without context, single-quoted attribute containing ','" ); - deepEqual( Sizzle( "input[data-comma=\"0,1\"]" ), [ document.getElementById("el12087") ], "Without context, double-quoted attribute containing ','" ); - deepEqual( Sizzle( "input[data-comma='0,1']", document.getElementById("t12087") ), [ document.getElementById("el12087") ], "With context, single-quoted attribute containing ','" ); - deepEqual( Sizzle( "input[data-comma=\"0,1\"]", document.getElementById("t12087") ), [ document.getElementById("el12087") ], "With context, double-quoted attribute containing ','" ); - - t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", ["radio1", "radio2", "hidden1"] ); - t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", ["radio1", "radio2", "hidden1"] ); - t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", ["radio1", "radio2", "hidden1"] ); - - t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] ); - - t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] ); - t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] ); - t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] ); - t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"] ); - - opt = document.getElementById("option1a"); - opt.attribs.test = ""; - - ok( Sizzle.matchesSelector( opt, "[id*=option1][type!=checkbox]" ), "Attribute Is Not Equal Matches" ); - ok( Sizzle.matchesSelector( opt, "[id*=option1]" ), "Attribute With No Quotes Contains Matches" ); - ok( Sizzle.matchesSelector( opt, "[test=]" ), "Attribute With No Quotes No Content Matches" ); - ok( !Sizzle.matchesSelector( opt, "[test^='']" ), "Attribute with empty string value does not match startsWith selector (^=)" ); - ok( Sizzle.matchesSelector( opt, "[id=option1a]" ), "Attribute With No Quotes Equals Matches" ); - ok( Sizzle.matchesSelector( document.getElementById("simon1"), "a[href*=#]" ), "Attribute With No Quotes Href Contains Matches" ); - - t( "Empty values", "#select1 option[value='']", ["option1a"] ); - t( "Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"] ); - - t( "Select options via :selected", "#select1 option:selected", ["option1a"] ); - t( "Select options via :selected", "#select2 option:selected", ["option2d"] ); - t( "Select options via :selected", "#select3 option:selected", ["option3b", "option3c"] ); - t( "Select options via :selected", "select[name='select2'] option:selected", ["option2d"] ); - - t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] ); - - input = document.getElementById("text1"); - input.attribs.title = "Don't click me"; - - ok( Sizzle.matchesSelector( input, "input[title=\"Don't click me\"]" ), "Quote within attribute value does not mess up tokenizer" ); - - // Uncomment if the boolHook is removed - // var check2 = document.getElementById("check2"); - // check2.checked = true; - // ok( !Sizzle.matches("[checked]", [ check2 ] ), "Dynamic boolean attributes match when they should with Sizzle.matches (#11115)" ); - - // jQuery #12303 - input.attribs["data-pos"] = ":first"; - ok( Sizzle.matchesSelector( input, "input[data-pos=\\:first]"), "POS within attribute value is treated as an attribute value" ); - ok( Sizzle.matchesSelector( input, "input[data-pos=':first']"), "POS within attribute value is treated as an attribute value" ); - ok( Sizzle.matchesSelector( input, ":input[data-pos=':first']"), "POS within attribute value after pseudo is treated as an attribute value" ); - delete input.attribs["data-pos"]; - - // Make sure attribute value quoting works correctly. See jQuery #6093; #6428; #13894 - // Use seeded results to bypass querySelectorAll optimizations - attrbad = jQuery( - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" - ).appendTo("#qunit-fixture"); - - t( "Underscores don't need escaping", "input[id=types_all]", ["types_all"] ); - - deepEqual( Sizzle( "input[name=foo\\ bar]", null, null, attrbad ), q("attrbad_space"), - "Escaped space" ); - deepEqual( Sizzle( "input[name=foo\\.baz]", null, null, attrbad ), q("attrbad_dot"), - "Escaped dot" ); - deepEqual( Sizzle( "input[name=foo\\[baz\\]]", null, null, attrbad ), q("attrbad_brackets"), - "Escaped brackets" ); - // deepEqual( Sizzle( "input[data-attr='foo_baz\\']']", null, null, attrbad ), q("attrbad_injection"), - // "Escaped quote + right bracket" ); - - // deepEqual( Sizzle( "input[data-attr='\\'']", null, null, attrbad ), q("attrbad_quote"), - // "Quoted quote" ); - // deepEqual( Sizzle( "input[data-attr='\\\\']", null, null, attrbad ), q("attrbad_backslash"), - // "Quoted backslash" ); - // deepEqual( Sizzle( "input[data-attr='\\\\\\'']", null, null, attrbad ), q("attrbad_backslash_quote"), - // "Quoted backslash quote" ); - // deepEqual( Sizzle( "input[data-attr='\\\\\\\\']", null, null, attrbad ), q("attrbad_backslash_backslash"), - // "Quoted backslash backslash" ); - - // deepEqual( Sizzle( "input[data-attr='\\5C\\\\']", null, null, attrbad ), q("attrbad_backslash_backslash"), - // "Quoted backslash backslash (numeric escape)" ); - // deepEqual( Sizzle( "input[data-attr='\\5C \\\\']", null, null, attrbad ), q("attrbad_backslash_backslash"), - // "Quoted backslash backslash (numeric escape with trailing space)" ); - // deepEqual( Sizzle( "input[data-attr='\\5C\t\\\\']", null, null, attrbad ), q("attrbad_backslash_backslash"), - // "Quoted backslash backslash (numeric escape with trailing tab)" ); - // deepEqual( Sizzle( "input[data-attr='\\04e00']", null, null, attrbad ), q("attrbad_unicode"), - // "Long numeric escape (BMP)" );*/ - document.getElementById("attrbad_unicode").attribs["data-attr"] = "\uD834\uDF06A"; - // It was too much code to fix Safari 5.x Supplemental Plane crashes (see ba5f09fa404379a87370ec905ffa47f8ac40aaa3) - deepEqual( Sizzle( "input[data-attr='\\01D306A']", null, null, attrbad ), q("attrbad_unicode"), - "Long numeric escape (non-BMP)" ); - - attrbad.remove(); - - t( "input[type=text]", "#form input[type=text]", ["text1", "text2", "hidden2", "name"] ); - t( "input[type=search]", "#form input[type=search]", ["search"] ); - t( "script[src] (jQuery #13777)", "#moretests script[src]", ["script-src"] ); - - // #3279 - div = document.createElement("div"); - div.children = helper.getDOM("
    "); - - deepEqual( Sizzle( "[xml\\:test]", div ), [ div.children[0] ], "Finding by attribute with escaped characters." ); - - div = document.getElementById("foo"); - t( "Object.prototype property \"constructor\" (negative)", "[constructor]", [] ); - t( "Gecko Object.prototype property \"watch\" (negative)", "[watch]", [] ); - div.attribs.constructor = "foo"; - div.attribs.watch = "bar"; - t( "Object.prototype property \"constructor\"", "[constructor='foo']", ["foo"] ); - t( "Gecko Object.prototype property \"watch\"", "[watch='bar']", ["foo"] ); - - t( "Value attribute is retrieved correctly", "input[value=Test]", ["text1", "text2"] ); -}); - -test("pseudo - (parent|empty)", function() { - expect( 3 ); - t( "Empty", "ul:empty", ["firstUL"] ); - t( "Empty with comment node", "ol:empty", ["empty"] ); - t( "Is A Parent", "#qunit-fixture p:parent", ["firstp","ap","sndp","en","sap","first"] ); -}); - -test("pseudo - (first|last|only)-(child|of-type)", function() { - expect( 12 ); - - t( "First Child", "p:first-child", ["firstp","sndp"] ); - t( "First Child (leading id)", "#qunit-fixture p:first-child", ["firstp","sndp"] ); - t( "First Child (leading class)", ".nothiddendiv div:first-child", ["nothiddendivchild"] ); - t( "First Child (case-insensitive)", "#qunit-fixture p:FIRST-CHILD", ["firstp","sndp"] ); - - t( "Last Child", "p:last-child", ["sap"] ); - t( "Last Child (leading id)", "#qunit-fixture a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon","liveLink1","liveLink2"] ); - - t( "Only Child", "#qunit-fixture a:only-child", ["simon1","anchor1","yahoo","anchor2","liveLink1","liveLink2"] ); - - t( "First-of-type", "#qunit-fixture > p:first-of-type", ["firstp"] ); - t( "Last-of-type", "#qunit-fixture > p:last-of-type", ["first"] ); - t( "Only-of-type", "#qunit-fixture > :only-of-type", ["name+value", "firstUL", "empty", "floatTest", "iframe", "table"] ); - - // Verify that the child position isn't being cached improperly - var secondChildren = jQuery(Sizzle("p:nth-child(2)")).before("
    "); - - t( "No longer second child", "p:nth-child(2)", [] ); - secondChildren.prev().remove(); - // t( "Restored second child", "p:nth-child(2)", ["ap","en"] ); -}); - -test("pseudo - nth-child", function() { - expect( 30 ); - - t( "Nth-child", "p:nth-child(1)", ["firstp","sndp"] ); - t( "Nth-child (with whitespace)", "p:nth-child( 1 )", ["firstp","sndp"] ); - t( "Nth-child (case-insensitive)", "#select1 option:NTH-child(3)", ["option1c"] ); - t( "Not nth-child", "#qunit-fixture p:not(:nth-child(1))", ["ap","en","sap","first"] ); - - t( "Nth-child(2)", "#qunit-fixture form#form > *:nth-child(2)", ["text1"] ); - t( "Nth-child(2)", "#qunit-fixture form#form > :nth-child(2)", ["text1"] ); - - t( "Nth-child(-1)", "#select1 option:nth-child(-1)", [] ); - t( "Nth-child(3)", "#select1 option:nth-child(3)", ["option1c"] ); - // t( "Nth-child(0n+3)", "#select1 option:nth-child(0n+3)", ["option1c"] ); - t( "Nth-child(1n+0)", "#select1 option:nth-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"] ); - t( "Nth-child(1n)", "#select1 option:nth-child(1n)", ["option1a", "option1b", "option1c", "option1d"] ); - t( "Nth-child(n)", "#select1 option:nth-child(n)", ["option1a", "option1b", "option1c", "option1d"] ); - t( "Nth-child(even)", "#select1 option:nth-child(even)", ["option1b", "option1d"] ); - t( "Nth-child(odd)", "#select1 option:nth-child(odd)", ["option1a", "option1c"] ); - t( "Nth-child(2n)", "#select1 option:nth-child(2n)", ["option1b", "option1d"] ); - t( "Nth-child(2n+1)", "#select1 option:nth-child(2n+1)", ["option1a", "option1c"] ); - t( "Nth-child(2n + 1)", "#select1 option:nth-child(2n + 1)", ["option1a", "option1c"] ); - t( "Nth-child(+2n + 1)", "#select1 option:nth-child(+2n + 1)", ["option1a", "option1c"] ); - t( "Nth-child(3n)", "#select1 option:nth-child(3n)", ["option1c"] ); - t( "Nth-child(3n+1)", "#select1 option:nth-child(3n+1)", ["option1a", "option1d"] ); - t( "Nth-child(3n+2)", "#select1 option:nth-child(3n+2)", ["option1b"] ); - t( "Nth-child(3n+3)", "#select1 option:nth-child(3n+3)", ["option1c"] ); - t( "Nth-child(3n-1)", "#select1 option:nth-child(3n-1)", ["option1b"] ); - t( "Nth-child(3n-2)", "#select1 option:nth-child(3n-2)", ["option1a", "option1d"] ); - t( "Nth-child(3n-3)", "#select1 option:nth-child(3n-3)", ["option1c"] ); - t( "Nth-child(3n+0)", "#select1 option:nth-child(3n+0)", ["option1c"] ); - t( "Nth-child(-1n+3)", "#select1 option:nth-child(-1n+3)", ["option1a", "option1b", "option1c"] ); - t( "Nth-child(-n+3)", "#select1 option:nth-child(-n+3)", ["option1a", "option1b", "option1c"] ); - t( "Nth-child(-1n + 3)", "#select1 option:nth-child(-1n + 3)", ["option1a", "option1b", "option1c"] ); - - // deepEqual( Sizzle( ":nth-child(n)", null, null, [ document.createElement("a") ].concat( q("ap") ) ), q("ap"), "Seeded nth-child" ); -}); - -test("pseudo - nth-last-child", function() { - expect( 30 ); - - t( "Nth-last-child", "form:nth-last-child(5)", ["testForm"] ); - t( "Nth-last-child (with whitespace)", "form:nth-last-child( 5 )", ["testForm"] ); - t( "Nth-last-child (case-insensitive)", "#select1 option:NTH-last-child(3)", ["option1b"] ); - t( "Not nth-last-child", "#qunit-fixture p:not(:nth-last-child(1))", ["firstp", "ap", "sndp", "en", "first"] ); - - t( "Nth-last-child(-1)", "#select1 option:nth-last-child(-1)", [] ); - t( "Nth-last-child(3)", "#select1 :nth-last-child(3)", ["option1b"] ); - t( "Nth-last-child(3)", "#select1 *:nth-last-child(3)", ["option1b"] ); - t( "Nth-last-child(3)", "#select1 option:nth-last-child(3)", ["option1b"] ); - // t( "Nth-last-child(0n+3)", "#select1 option:nth-last-child(0n+3)", ["option1b"] ); - t( "Nth-last-child(1n+0)", "#select1 option:nth-last-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"] ); - t( "Nth-last-child(1n)", "#select1 option:nth-last-child(1n)", ["option1a", "option1b", "option1c", "option1d"] ); - t( "Nth-last-child(n)", "#select1 option:nth-last-child(n)", ["option1a", "option1b", "option1c", "option1d"] ); - t( "Nth-last-child(even)", "#select1 option:nth-last-child(even)", ["option1a", "option1c"] ); - t( "Nth-last-child(odd)", "#select1 option:nth-last-child(odd)", ["option1b", "option1d"] ); - t( "Nth-last-child(2n)", "#select1 option:nth-last-child(2n)", ["option1a", "option1c"] ); - t( "Nth-last-child(2n+1)", "#select1 option:nth-last-child(2n+1)", ["option1b", "option1d"] ); - t( "Nth-last-child(2n + 1)", "#select1 option:nth-last-child(2n + 1)", ["option1b", "option1d"] ); - t( "Nth-last-child(+2n + 1)", "#select1 option:nth-last-child(+2n + 1)", ["option1b", "option1d"] ); - t( "Nth-last-child(3n)", "#select1 option:nth-last-child(3n)", ["option1b"] ); - t( "Nth-last-child(3n+1)", "#select1 option:nth-last-child(3n+1)", ["option1a", "option1d"] ); - t( "Nth-last-child(3n+2)", "#select1 option:nth-last-child(3n+2)", ["option1c"] ); - t( "Nth-last-child(3n+3)", "#select1 option:nth-last-child(3n+3)", ["option1b"] ); - t( "Nth-last-child(3n-1)", "#select1 option:nth-last-child(3n-1)", ["option1c"] ); - t( "Nth-last-child(3n-2)", "#select1 option:nth-last-child(3n-2)", ["option1a", "option1d"] ); - t( "Nth-last-child(3n-3)", "#select1 option:nth-last-child(3n-3)", ["option1b"] ); - t( "Nth-last-child(3n+0)", "#select1 option:nth-last-child(3n+0)", ["option1b"] ); - t( "Nth-last-child(-1n+3)", "#select1 option:nth-last-child(-1n+3)", ["option1b", "option1c", "option1d"] ); - t( "Nth-last-child(-n+3)", "#select1 option:nth-last-child(-n+3)", ["option1b", "option1c", "option1d"] ); - t( "Nth-last-child(-1n + 3)", "#select1 option:nth-last-child(-1n + 3)", ["option1b", "option1c", "option1d"] ); - - // deepEqual( Sizzle( ":nth-last-child(n)", null, null, [ document.createElement("a") ].concat( q("ap") ) ), q("ap"), "Seeded nth-last-child" ); -}); - -test("pseudo - nth-of-type", function() { - expect( 9 ); - t( "Nth-of-type(-1)", ":nth-of-type(-1)", [] ); - t( "Nth-of-type(3)", "#ap :nth-of-type(3)", ["mark"] ); - t( "Nth-of-type(n)", "#ap :nth-of-type(n)", ["google", "groups", "code1", "anchor1", "mark"] ); - t( "Nth-of-type(0n+3)", "#ap :nth-of-type(0n+3)", ["mark"] ); - t( "Nth-of-type(2n)", "#ap :nth-of-type(2n)", ["groups"] ); - t( "Nth-of-type(even)", "#ap :nth-of-type(even)", ["groups"] ); - t( "Nth-of-type(2n+1)", "#ap :nth-of-type(2n+1)", ["google", "code1", "anchor1", "mark"] ); - t( "Nth-of-type(odd)", "#ap :nth-of-type(odd)", ["google", "code1", "anchor1", "mark"] ); - t( "Nth-of-type(-n+2)", "#qunit-fixture > :nth-of-type(-n+2)", ["firstp", "ap", "foo", "nothiddendiv", "name+value", "firstUL", "empty", "form", "floatTest", "iframe", "lengthtest", "table"] ); -}); - -test("pseudo - nth-last-of-type", function() { - expect( 9 ); - t( "Nth-last-of-type(-1)", ":nth-last-of-type(-1)", [] ); - t( "Nth-last-of-type(3)", "#ap :nth-last-of-type(3)", ["google"] ); - t( "Nth-last-of-type(n)", "#ap :nth-last-of-type(n)", ["google", "groups", "code1", "anchor1", "mark"] ); - t( "Nth-last-of-type(0n+3)", "#ap :nth-last-of-type(0n+3)", ["google"] ); - t( "Nth-last-of-type(2n)", "#ap :nth-last-of-type(2n)", ["groups"] ); - t( "Nth-last-of-type(even)", "#ap :nth-last-of-type(even)", ["groups"] ); - t( "Nth-last-of-type(2n+1)", "#ap :nth-last-of-type(2n+1)", ["google", "code1", "anchor1", "mark"] ); - t( "Nth-last-of-type(odd)", "#ap :nth-last-of-type(odd)", ["google", "code1", "anchor1", "mark"] ); - t( "Nth-last-of-type(-n+2)", "#qunit-fixture > :nth-last-of-type(-n+2)", ["ap", "name+value", "first", "firstUL", "empty", "floatTest", "iframe", "table", "name-tests", "testForm", "liveHandlerOrder", "siblingTest"] ); -}); - -test("pseudo - has", function() { - expect( 3 ); - - t( "Basic test", "p:has(a)", ["firstp","ap","en","sap"] ); - t( "Basic test (irrelevant whitespace)", "p:has( a )", ["firstp","ap","en","sap"] ); - t( "Nested with overlapping candidates", "#qunit-fixture div:has(div:has(div:not([id])))", [ "moretests", "t2037" ] ); -}); - -test("pseudo - misc", function() { - expect( 39 ); - - var select, tmp, input; - - t( "Headers", ":header", ["qunit-header", "qunit-banner", "qunit-userAgent"] ); - t( "Headers(case-insensitive)", ":Header", ["qunit-header", "qunit-banner", "qunit-userAgent"] ); - t( "Multiple matches with the same context (cache check)", "#form select:has(option:first-child:contains('o'))", ["select1", "select2", "select3", "select4"] ); - - ok( Sizzle("#qunit-fixture :not(:has(:has(*)))").length, "All not grandparents" ); - - select = document.getElementById("select1"); - ok( Sizzle.matchesSelector( select, ":has(option)" ), "Has Option Matches" ); - - ok( Sizzle("a:contains('')").length, "Empty string contains" ); - t( "Text Contains", "a:contains(Google)", ["google","groups"] ); - t( "Text Contains", "a:contains(Google Groups)", ["groups"] ); - - t( "Text Contains", "a:contains('Google Groups (Link)')", ["groups"] ); - t( "Text Contains", "a:contains(\"(Link)\")", ["groups"] ); - t( "Text Contains", "a:contains(Google Groups (Link))", ["groups"] ); - t( "Text Contains", "a:contains((Link))", ["groups"] ); - - - tmp = document.createElement("div"); - tmp.attribs.id = "tmp_input"; - document.body.children.push( tmp ); - - [ "button", "submit", "reset" ].forEach(function( type ) { - var els = jQuery( - "" - .replace( /%/g, type ) - ).appendTo( tmp ); - - t( "Input Buttons :" + type, "#tmp_input :" + type, [ "input_" + type, "button_" + type ] ); - - ok( Sizzle.matchesSelector( els[0], ":" + type ), "Input Matches :" + type ); - ok( Sizzle.matchesSelector( els[1], ":" + type ), "Button Matches :" + type ); - }); - - document.body.children.pop(); - - // Recreate tmp - tmp = document.createElement("div"); - tmp.attribs.id = "tmp_input"; - tmp.children = helper.getDOM("Hello I am focusable."); - // Setting tabIndex should make the element focusable - // http://dev.w3.org/html5/spec/single-page.html#focus-management - document.body.children.push( tmp ); - tmp.tabIndex = 0; - //tmp.focus(); - if ( document.activeElement !== tmp || (document.hasFocus && !document.hasFocus()) || - (document.querySelectorAll && !document.querySelectorAll("div:focus").length) ) { - ok( true, "The div was not focused. Skip checking the :focus match." ); - ok( true, "The div was not focused. Skip checking the :focus match." ); - } else { - t( "tabIndex element focused", ":focus", [ "tmp_input" ] ); - ok( Sizzle.matchesSelector( tmp, ":focus" ), ":focus matches tabIndex div" ); - } - - // Blur tmp - //tmp.blur(); - //document.body.focus(); - //ok( !Sizzle.matchesSelector( tmp, ":focus" ), ":focus doesn't match tabIndex div" ); - document.body.children.pop(); - - // Input focus/active - input = document.createElement("input"); - input.attribs.type = "text"; - input.attribs.id = "focus-input"; - - document.body.children.push( input ); - //input.focus(); - - // Inputs can't be focused unless the document has focus - if ( document.activeElement !== input || (document.hasFocus && !document.hasFocus()) || - (document.querySelectorAll && !document.querySelectorAll("input:focus").length) ) { - ok( true, "The input was not focused. Skip checking the :focus match." ); - ok( true, "The input was not focused. Skip checking the :focus match." ); - } else { - t( "Element focused", "input:focus", [ "focus-input" ] ); - ok( Sizzle.matchesSelector( input, ":focus" ), ":focus matches" ); - } - - //input.blur(); - - // When IE is out of focus, blur does not work. Force it here. - if ( document.activeElement === input ) { - document.body.focus(); - } - - //ok( !Sizzle.matchesSelector( input, ":focus" ), ":focus doesn't match" ); - document.body.children.pop(); - - - - deepEqual( - Sizzle( "[id='select1'] *:not(:last-child), [id='select2'] *:not(:last-child)", q("qunit-fixture")[0] ), - q( "option1a", "option1b", "option1c", "option2a", "option2b", "option2c" ), - "caching system tolerates recursive selection" - ); - - // Tokenization edge cases - t( "Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code)", ["ap"] ); - t( "Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code):contains(This link)", ["ap"] ); - - // t( "Pseudo argument containing ')'", "p:has(>a.GROUPS[src!=')'])", ["ap"] ); - // t( "Pseudo argument containing ')'", "p:has(>a.GROUPS[src!=')'])", ["ap"] ); - t( "Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=\\)]", ["sndp"] ); - t( "Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=')']", ["sndp"] ); - - t( "Multi-pseudo", "#ap:has(*), #ap:has(*)", ["ap"] ); - //t( "Multi-positional", "#ap:gt(0), #ap:lt(1)", ["ap"] ); - t( "Multi-pseudo with leading nonexistent id", "#nonexistent:has(*), #ap:has(*)", ["ap"] ); - //t( "Multi-positional with leading nonexistent id", "#nonexistent:gt(0), #ap:lt(1)", ["ap"] ); - - t( "Tokenization stressor", "a[class*=blog]:not(:has(*, :contains(!)), :contains(!)), br:contains(]), p:contains(]), :not(:empty):not(:parent)", ["ap", "mark","yahoo","simon"] ); -}); - - -test("pseudo - :not", function() { - expect( 43 ); - - t( "Not", "a.blog:not(.link)", ["mark"] ); - //t( ":not() with :first", "#foo p:not(:first) .link", ["simon"] ); - - t( "Not - multiple", "#form option:not(:contains(Nothing),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e", "option4e", "option5b", "option5c"] ); - t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"] ); - - t( ":not() failing interior", "#qunit-fixture p:not(.foo)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not() failing interior", "#qunit-fixture p:not(div.foo)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not() failing interior", "#qunit-fixture p:not(p.foo)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not() failing interior", "#qunit-fixture p:not(#blargh)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not() failing interior", "#qunit-fixture p:not(div#blargh)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not() failing interior", "#qunit-fixture p:not(p#blargh)", ["firstp","ap","sndp","en","sap","first"] ); - - t( ":not Multiple", "#qunit-fixture p:not(a)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not Multiple", "#qunit-fixture p:not( a )", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not Multiple", "#qunit-fixture p:not( p )", [] ); - t( ":not Multiple", "#qunit-fixture p:not(a, b)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not Multiple", "#qunit-fixture p:not(a, b, div)", ["firstp","ap","sndp","en","sap","first"] ); - t( ":not Multiple", "p:not(p)", [] ); - t( ":not Multiple", "p:not(a,p)", [] ); - t( ":not Multiple", "p:not(p,a)", [] ); - t( ":not Multiple", "p:not(a,p,b)", [] ); - t( ":not Multiple", ":input:not(:image,:input,:submit)", [] ); - t( ":not Multiple", "#qunit-fixture p:not(:has(a), :nth-child(1))", ["first"] ); - - t( "No element not selector", ".container div:not(.excluded) div", [] ); - - t( ":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2", "select5"]); - t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3", "select4","select5"]); - t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3", "select4", "select5"]); - - t( ":not() Multiple Class", "#foo a:not(.blog)", ["yahoo", "anchor2"] ); - t( ":not() Multiple Class", "#foo a:not(.link)", ["yahoo", "anchor2"] ); - t( ":not() Multiple Class", "#foo a:not(.blog.link)", ["yahoo", "anchor2"] ); - - t( ":not chaining (compound)", "#qunit-fixture div[id]:not(:has(div, span)):not(:has(*))", ["nothiddendivchild", "divWithNoTabIndex"] ); - t( ":not chaining (with attribute)", "#qunit-fixture form[id]:not([action$='formaction']):not(:button)", ["lengthtest", "name-tests", "testForm"] ); - t( ":not chaining (colon in attribute)", "#qunit-fixture form[id]:not([action='form:action']):not(:button)", ["form", "lengthtest", "name-tests", "testForm"] ); - t( ":not chaining (colon in attribute and nested chaining)", "#qunit-fixture form[id]:not([action='form:action']:button):not(:input)", ["form", "lengthtest", "name-tests", "testForm"] ); - t( ":not chaining", "#form select:not(.select1):contains(Nothing) > option:not(option)", [] ); - - /* - t( "positional :not()", "#foo p:not(:last)", ["sndp", "en"] ); - t( "positional :not() prefix", "#foo p:not(:last) a", ["yahoo"] ); - t( "compound positional :not()", "#foo p:not(:first, :last)", ["en"] ); - t( "compound positional :not()", "#foo p:not(:first, :even)", ["en"] ); - t( "compound positional :not()", "#foo p:not(:first, :odd)", ["sap"] ); - t( "reordered compound positional :not()", "#foo p:not(:odd, :first)", ["sap"] ); - - t( "positional :not() with pre-filter", "#foo p:not([id]:first)", ["en", "sap"] ); - t( "positional :not() with post-filter", "#foo p:not(:first[id])", ["en", "sap"] ); - t( "positional :not() with pre-filter", "#foo p:not([lang]:first)", ["sndp", "sap"] ); - t( "positional :not() with post-filter", "#foo p:not(:first[lang])", ["sndp", "en", "sap"] ); - */ -}); - -/* -test("pseudo - position", function() { - expect( 33 ); - - t( "First element", "div:first", ["qunit"] ); - t( "First element(case-insensitive)", "div:fiRst", ["qunit"] ); - t( "nth Element", "#qunit-fixture p:nth(1)", ["ap"] ); - t( "First Element", "#qunit-fixture p:first", ["firstp"] ); - t( "Last Element", "p:last", ["first"] ); - t( "Even Elements", "#qunit-fixture p:even", ["firstp","sndp","sap"] ); - t( "Odd Elements", "#qunit-fixture p:odd", ["ap","en","first"] ); - t( "Position Equals", "#qunit-fixture p:eq(1)", ["ap"] ); - t( "Position Equals (negative)", "#qunit-fixture p:eq(-1)", ["first"] ); - t( "Position Greater Than", "#qunit-fixture p:gt(0)", ["ap","sndp","en","sap","first"] ); - t( "Position Less Than", "#qunit-fixture p:lt(3)", ["firstp","ap","sndp"] ); - - t( "Check position filtering", "div#nothiddendiv:eq(0)", ["nothiddendiv"] ); - t( "Check position filtering", "div#nothiddendiv:last", ["nothiddendiv"] ); - t( "Check position filtering", "div#nothiddendiv:not(:gt(0))", ["nothiddendiv"] ); - t( "Check position filtering", "#foo > :not(:first)", ["en", "sap"] ); - t( "Check position filtering", "#qunit-fixture select > :not(:gt(2))", ["option1a", "option1b", "option1c"] ); - t( "Check position filtering", "#qunit-fixture select:lt(2) :not(:first)", ["option1b", "option1c", "option1d", "option2a", "option2b", "option2c", "option2d"] ); - t( "Check position filtering", "div.nothiddendiv:eq(0)", ["nothiddendiv"] ); - t( "Check position filtering", "div.nothiddendiv:last", ["nothiddendiv"] ); - t( "Check position filtering", "div.nothiddendiv:not(:lt(0))", ["nothiddendiv"] ); - - t( "Check element position", "#qunit-fixture div div:eq(0)", ["nothiddendivchild"] ); - t( "Check element position", "#select1 option:eq(3)", ["option1d"] ); - t( "Check element position", "#qunit-fixture div div:eq(10)", ["names-group"] ); - t( "Check element position", "#qunit-fixture div div:first", ["nothiddendivchild"] ); - t( "Check element position", "#qunit-fixture div > div:first", ["nothiddendivchild"] ); - t( "Check element position", "#dl div:first div:first", ["foo"] ); - t( "Check element position", "#dl div:first > div:first", ["foo"] ); - t( "Check element position", "div#nothiddendiv:first > div:first", ["nothiddendivchild"] ); - t( "Chained pseudo after a pos pseudo", "#listWithTabIndex li:eq(0):contains(Rice)", ["foodWithNegativeTabIndex"] ); - - t( "Check sort order with POS and comma", "#qunit-fixture em>em>em>em:first-child,div>em:first", ["siblingfirst", "siblinggreatgrandchild"] ); - - t( "Isolated position", ":last", ["last"] ); - - deepEqual( Sizzle( "*:lt(2) + *", null, [], Sizzle("#qunit-fixture > p") ), q("ap"), "Seeded pos with trailing relative" ); - - // jQuery #12526 - var context = jQuery("#qunit-fixture").append("
    ")[0]; - deepEqual( Sizzle( ":last", context ), q("jquery12526"), "Post-manipulation positional" ); -}); -*/ - -test("pseudo - form", function() { - expect( 10 ); - - var extraTexts = jQuery("").appendTo("#form"); - - t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3", "select4", "select5", "impliedText", "capitalText"] ); - t( "Form element :radio", "#form :radio", ["radio1", "radio2"] ); - t( "Form element :checkbox", "#form :checkbox", ["check1", "check2"] ); - t( "Form element :text", "#form :text", ["text1", "text2", "hidden2", "name", "impliedText", "capitalText"] ); - t( "Form element :radio:checked", "#form :radio:checked", ["radio2"] ); - t( "Form element :checkbox:checked", "#form :checkbox:checked", ["check1"] ); - t( "Form element :radio:checked, :checkbox:checked", "#form :radio:checked, #form :checkbox:checked", ["radio2", "check1"] ); - - t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d","option5a"] ); - t( "Selected Option Element are also :checked", "#form option:checked", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d","option5a"] ); - t( "Hidden inputs should be treated as enabled. See QSA test.", "#hidden1:enabled", ["hidden1"] ); - - extraTexts.remove(); -}); - -test("pseudo - :target and :root", function() { - expect( 2 ); - /* // TODO add shim from qwery tests - // Target - var oldHash, - $link = jQuery("").attr({ - href: "#", - id: "new-link" - }).appendTo("#qunit-fixture"); - - oldHash = window.location.hash; - window.location.hash = "new-link"; - - t( ":target", ":target", ["new-link"] ); - - $link.remove(); - window.location.hash = oldHash;*/ - - // Root - equal( Sizzle(":root")[0], document.documentElement, ":root selector" ); -}); - -/* -// TODO -test("pseudo - :lang", function() { - expect( 105 ); - - var docElem = document.documentElement, - docXmlLang = docElem.getAttribute("xml:lang"), - docLang = docElem.lang, - foo = document.getElementById("foo"), - anchor = document.getElementById("anchor2"), - xml = createWithFriesXML(), - testLang = function( text, elem, container, lang, extra ) { - var message, - full = lang + "-" + extra; - - message = "lang=" + lang + " " + text; - container.setAttribute( container.ownerDocument.documentElement.nodeName === "HTML" ? "lang" : "xml:lang", lang ); - assertMatch( message, elem, ":lang(" + lang + ")" ); - assertMatch( message, elem, ":lang(" + mixCase(lang) + ")" ); - assertNoMatch( message, elem, ":lang(" + full + ")" ); - assertNoMatch( message, elem, ":lang(" + mixCase(full) + ")" ); - assertNoMatch( message, elem, ":lang(" + lang + "-)" ); - assertNoMatch( message, elem, ":lang(" + full + "-)" ); - assertNoMatch( message, elem, ":lang(" + lang + "glish)" ); - assertNoMatch( message, elem, ":lang(" + full + "glish)" ); - - message = "lang=" + full + " " + text; - container.setAttribute( container.ownerDocument.documentElement.nodeName === "HTML" ? "lang" : "xml:lang", full ); - assertMatch( message, elem, ":lang(" + lang + ")" ); - assertMatch( message, elem, ":lang(" + mixCase(lang) + ")" ); - assertMatch( message, elem, ":lang(" + full + ")" ); - assertMatch( message, elem, ":lang(" + mixCase(full) + ")" ); - assertNoMatch( message, elem, ":lang(" + lang + "-)" ); - assertNoMatch( message, elem, ":lang(" + full + "-)" ); - assertNoMatch( message, elem, ":lang(" + lang + "glish)" ); - assertNoMatch( message, elem, ":lang(" + full + "glish)" ); - }, - mixCase = function( str ) { - var ret = str.split(""), - i = ret.length; - while ( i-- ) { - if ( i & 1 ) { - ret[i] = ret[i].toUpperCase(); - } - } - return ret.join(""); - }, - assertMatch = function( text, elem, selector ) { - ok( Sizzle.matchesSelector( elem, selector ), text + " match " + selector ); - }, - assertNoMatch = function( text, elem, selector ) { - ok( !Sizzle.matchesSelector( elem, selector ), text + " fail " + selector ); - }; - - // Prefixing and inheritance - ok( Sizzle.matchesSelector( docElem, ":lang(" + docElem.lang + ")" ), "starting :lang" ); - testLang( "document", anchor, docElem, "en", "us" ); - testLang( "grandparent", anchor, anchor.parentNode.parentNode, "yue", "hk" ); - ok( !Sizzle.matchesSelector( anchor, ":lang(en), :lang(en-us)" ), - ":lang does not look above an ancestor with specified lang" ); - testLang( "self", anchor, anchor, "es", "419" ); - ok( !Sizzle.matchesSelector( anchor, ":lang(en), :lang(en-us), :lang(yue), :lang(yue-hk)" ), - ":lang does not look above self with specified lang" ); - - // Searching by language tag - anchor.parentNode.parentNode.lang = "arab"; - anchor.parentNode.lang = anchor.parentNode.id = "ara-sa"; - anchor.lang = "ara"; - deepEqual( Sizzle( ":lang(ara)", foo ), [ anchor.parentNode, anchor ], "Find by :lang" ); - - // Selector validity - anchor.parentNode.lang = "ara"; - anchor.lang = "ara\\b"; - deepEqual( Sizzle( ":lang(ara\\b)", foo ), [], ":lang respects backslashes" ); - deepEqual( Sizzle( ":lang(ara\\\\b)", foo ), [ anchor ], ":lang respects escaped backslashes" ); - raises(function() { - Sizzle.call( null, "dl:lang(c++)" ); - }, function( e ) { - return e.message.indexOf("Syntax error") >= 0; - }, ":lang value must be a valid identifier" ); - - // XML - foo = jQuery( "response", xml )[0]; - anchor = jQuery( "#seite1", xml )[0]; - testLang( "XML document", anchor, xml.documentElement, "en", "us" ); - testLang( "XML grandparent", anchor, foo, "yue", "hk" ); - ok( !Sizzle.matchesSelector( anchor, ":lang(en), :lang(en-us)" ), - "XML :lang does not look above an ancestor with specified lang" ); - testLang( "XML self", anchor, anchor, "es", "419" ); - ok( !Sizzle.matchesSelector( anchor, ":lang(en), :lang(en-us), :lang(yue), :lang(yue-hk)" ), - "XML :lang does not look above self with specified lang" ); - - // Cleanup - if ( docXmlLang == null ) { - docElem.removeAttribute("xml:lang"); - } else { - docElem.setAttribute( "xml:lang", docXmlLang ); - } - docElem.lang = docLang; -}); -*/ - -test("caching", function() { - expect( 1 ); - Sizzle( ":not(code)", document.getElementById("ap") ); - deepEqual( Sizzle( ":not(code)", document.getElementById("foo") ), q("sndp", "en", "yahoo", "sap", "anchor2", "simon"), "Reusing selector with new context" ); -}); -/* -asyncTest( "Iframe dispatch should not affect Sizzle, see jQuery #13936", 1, function() { - var i = 0, - thrown = false, - iframe = document.getElementById("iframe"), - iframeDoc = iframe.contentDocument || iframe.contentWindow.document; - - jQuery( iframe ).on( "load", function() { - var doc; - - try { - i++; - doc = this.contentDocument || this.contentWindow.document; - Sizzle( "form", doc ).pop().submit(); - - } catch ( e ) { - thrown = true; - } - - if ( i === 2 ) { - jQuery( this ).off("load"); - ok( !thrown, "Iframe reload should not affect Sizzle, see jQuery #13936" ); - start(); - } - }); - - iframeDoc.open(); - iframeDoc.write("
    "); - iframeDoc.close(); -}); -*/ \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/test.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/test.js deleted file mode 100644 index 99a486d4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/test.js +++ /dev/null @@ -1,22 +0,0 @@ -describe("nwmatcher", function(){ - require("./nwmatcher/"); -}); - -describe("sizzle", function(){ - describe("selector", function(){ - require("./sizzle/selector"); - }); -}); - -describe("qwery", function(){ - exportsRun(require("./qwery/")); -}); - -function exportsRun(mod){ - Object.keys(mod).forEach(function(name){ - if(typeof mod[name] === "object") describe(name, function(){ - exportsRun(mod[name]); - }); - else it(name, mod[name]); - }); -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/bench.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/bench.js deleted file mode 100644 index ef251b19..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/bench.js +++ /dev/null @@ -1,10 +0,0 @@ -var ben = require("ben"), - testString = "doo, *#foo > elem.bar[class$=bAz i]:not([ id *= \"2\" ]):nth-child(2n)", - helper = require("./helper.js"), - CSSselect = helper.CSSselect, - compile = CSSselect.compile, - dom = helper.getDefaultDom(); - -//console.log("Parsing took:", ben(1e5, function(){compile(testString);})); -var compiled = compile(testString); -console.log("Executing took:", ben(1e6, function(){CSSselect(compiled, dom);})*1e3); \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/helper.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/helper.js deleted file mode 100644 index 0b08e98a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/helper.js +++ /dev/null @@ -1,51 +0,0 @@ -var fs = require("fs"), - path = require("path"), - htmlparser2 = require("htmlparser2"), - DomUtils = htmlparser2.DomUtils, - CSSselect = require("../../"); - -function getDOMFromPath(path, options){ - return htmlparser2.parseDOM(fs.readFileSync(path).toString(), options); -} - -module.exports = { - CSSselect: CSSselect, - getFile: function(name, options){ - return getDOMFromPath(path.join(__dirname, "docs", name), options); - }, - getDOMFromPath: getDOMFromPath, - getDOM: htmlparser2.parseDOM, - getDefaultDom: function(){ - return htmlparser2.parseDOM( - " This is some simple text " - ); - }, - getDocument: function(path){ - var document = getDOMFromPath(path); - - document.getElementsByTagName = function(name){ - return DomUtils.getElementsByTagName("*", document); - }; - document.getElementById = function(id){ - return DomUtils.getElementById(id, document); - }; - document.createTextNode = function(content){ - return { - type: "text", - data: "content" - }; - }; - document.createElement = function(name){ - return { - type: "tag", - name: name, - children: [], - attribs: {} - }; - }; - document.body = DomUtils.getElementsByTagName("body", document, true, 1)[0]; - document.documentElement = document.filter(DomUtils.isTag)[0]; - - return document; - } -}; \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/slickspeed.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/slickspeed.js deleted file mode 100644 index 86027754..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/CSSselect/test/tools/slickspeed.js +++ /dev/null @@ -1,76 +0,0 @@ -var helper = require("./helper.js"), - doc = helper.getFile("W3C_Selectors.html"), - CSSselect = helper.CSSselect, - soupselect = require("cheerio-soupselect"), - selectors = ["body", "div", "body div", "div p", "div > p", "div + p", "div ~ p", "div[class^=exa][class$=mple]", "div p a", "div, p, a", ".note", "div.example", "ul .tocline2", "div.example, div.note", "#title", "h1#title", "div #title", "ul.toc li.tocline2", "ul.toc > li.tocline2", "h1#title + div > p", "h1[id]:contains(Selectors)", "a[href][lang][class]", "div[class]", "div[class=example]", "div[class^=exa]", "div[class$=mple]", "div[class*=e]", "div[class|=dialog]", "div[class!=made_up]", "div[class~=example]"/*, "div:not(.example)", "p:contains(selectors)", "p:nth-child(even)", "p:nth-child(2n)", "p:nth-child(odd)", "p:nth-child(2n+1)", "p:nth-child(n)", "p:only-child", "p:last-child", "p:first-child"*/]; - -var engines = [function(a,b){return CSSselect(b,a);}, soupselect.select]; - -//returns true when an error occurs -function testResult(rule, index){ - var results = engines - .map(function(func){ return func(doc, rule); }); - - //check if both had the same result - for(var i = 1; i < results.length; i++){ - //TODO: might be hard to debug with more engines - if(results[i-1].length !== results[i].length){ - //console.log(rule, results[i-1].length, results[i].length); - return true; - } - for(var j = 0; j < results[i].length; j++){ - if(results[i-1][j] !== results[i][j]){ - if(results[i-1].indexOf(results[i][j]) === -1){ - return true; - } - } - } - //require("assert").deepEqual(results[i-1], results[i], rule + ": not the same elements"); - } - - return false; -} - -selectors.filter(testResult).forEach(function(rule){ print(rule, "failed!\n"); }); - -process.exit(0); //don't run speed tests - -print("-----\n\nChecking performance\n\n"); - -//test the speed -var ben = require("ben"); - -function testSpeed(rule){ - print(rule, Array(28-rule.length).join(" ")); - - var results = engines - .map(function(func){ return function(){ return func(doc, rule); }}); - - //also add a precompiled CSSselect test - var compiled = CSSselect(rule); - results.unshift(function(){ return CSSselect.iterate(compiled, doc); }); - - results = results.map(ben); - - var min = Math.min.apply(null, results); - var max = Math.max.apply(null, results); - - results.forEach(function(result){ - if(result === min) return print(" +", result, "+"); - if(result === max) return print(" !", result, "!"); - if(Math.abs(result-min) > Math.abs(result-max)){ - return print(" =", result, "="); - } - print(" ~", result, "~"); - }); - - print("\n"); -} - -print("RULE ", "CSSselect (pc)", "CSSselect", "soupselect\n"); - -selectors.forEach(testSpeed); - -function print(){ - process.stdout.write(Array.prototype.join.call(arguments, " ")); -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/LICENSE deleted file mode 100644 index c464f863..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Felix Böhm -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/html4.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/html4.json deleted file mode 100644 index 0253d1aa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/html4.json +++ /dev/null @@ -1 +0,0 @@ -{"Aacute;":"\u00C1","Aacute":"\u00C1","aacute;":"\u00E1","aacute":"\u00E1","Acirc;":"\u00C2","Acirc":"\u00C2","acirc;":"\u00E2","acirc":"\u00E2","acute;":"\u00B4","acute":"\u00B4","AElig;":"\u00C6","AElig":"\u00C6","aelig;":"\u00E6","aelig":"\u00E6","Agrave;":"\u00C0","Agrave":"\u00C0","agrave;":"\u00E0","agrave":"\u00E0","alefsym;":"\u2135","Alpha;":"\u0391","alpha;":"\u03B1","amp":"\u0026","and;":"\u2227","ang;":"\u2220","apos":"\u0027","Aring;":"\u00C5","Aring":"\u00C5","aring;":"\u00E5","aring":"\u00E5","asymp;":"\u2248","Atilde;":"\u00C3","Atilde":"\u00C3","atilde;":"\u00E3","atilde":"\u00E3","Auml;":"\u00C4","Auml":"\u00C4","auml;":"\u00E4","auml":"\u00E4","bdquo;":"\u201E","Beta;":"\u0392","beta;":"\u03B2","brvbar;":"\u00A6","brvbar":"\u00A6","bull;":"\u2022","cap;":"\u2229","Ccedil;":"\u00C7","Ccedil":"\u00C7","ccedil;":"\u00E7","ccedil":"\u00E7","cedil;":"\u00B8","cedil":"\u00B8","cent;":"\u00A2","cent":"\u00A2","Chi;":"\u03A7","chi;":"\u03C7","circ;":"\u02C6","clubs;":"\u2663","cong;":"\u2245","copy;":"\u00A9","copy":"\u00A9","crarr;":"\u21B5","cup;":"\u222A","curren;":"\u00A4","curren":"\u00A4","dagger;":"\u2020","Dagger;":"\u2021","darr;":"\u2193","dArr;":"\u21D3","deg;":"\u00B0","deg":"\u00B0","Delta;":"\u0394","delta;":"\u03B4","diams;":"\u2666","divide;":"\u00F7","divide":"\u00F7","Eacute;":"\u00C9","Eacute":"\u00C9","eacute;":"\u00E9","eacute":"\u00E9","Ecirc;":"\u00CA","Ecirc":"\u00CA","ecirc;":"\u00EA","ecirc":"\u00EA","Egrave;":"\u00C8","Egrave":"\u00C8","egrave;":"\u00E8","egrave":"\u00E8","empty;":"\u2205","emsp;":"\u2003","ensp;":"\u2002","Epsilon;":"\u0395","epsilon;":"\u03B5","equiv;":"\u2261","Eta;":"\u0397","eta;":"\u03B7","ETH;":"\u00D0","ETH":"\u00D0","eth;":"\u00F0","eth":"\u00F0","Euml;":"\u00CB","Euml":"\u00CB","euml;":"\u00EB","euml":"\u00EB","euro;":"\u20AC","exist;":"\u2203","fnof;":"\u0192","forall;":"\u2200","frac12;":"\u00BD","frac12":"\u00BD","frac14;":"\u00BC","frac14":"\u00BC","frac34;":"\u00BE","frac34":"\u00BE","frasl;":"\u2044","Gamma;":"\u0393","gamma;":"\u03B3","ge;":"\u2265","gt":"\u003E","harr;":"\u2194","hArr;":"\u21D4","hearts;":"\u2665","hellip;":"\u2026","Iacute;":"\u00CD","Iacute":"\u00CD","iacute;":"\u00ED","iacute":"\u00ED","Icirc;":"\u00CE","Icirc":"\u00CE","icirc;":"\u00EE","icirc":"\u00EE","iexcl;":"\u00A1","iexcl":"\u00A1","Igrave;":"\u00CC","Igrave":"\u00CC","igrave;":"\u00EC","igrave":"\u00EC","image;":"\u2111","infin;":"\u221E","int;":"\u222B","Iota;":"\u0399","iota;":"\u03B9","iquest;":"\u00BF","iquest":"\u00BF","isin;":"\u2208","Iuml;":"\u00CF","Iuml":"\u00CF","iuml;":"\u00EF","iuml":"\u00EF","Kappa;":"\u039A","kappa;":"\u03BA","Lambda;":"\u039B","lambda;":"\u03BB","lang;":"\u27E8","laquo;":"\u00AB","laquo":"\u00AB","larr;":"\u2190","lArr;":"\u21D0","lceil;":"\u2308","ldquo;":"\u201C","le;":"\u2264","lfloor;":"\u230A","lowast;":"\u2217","loz;":"\u25CA","lrm;":"\u200E","lsaquo;":"\u2039","lsquo;":"\u2018","lt":"\u003C","macr;":"\u00AF","macr":"\u00AF","mdash;":"\u2014","micro;":"\u00B5","micro":"\u00B5","middot;":"\u00B7","middot":"\u00B7","minus;":"\u2212","Mu;":"\u039C","mu;":"\u03BC","nabla;":"\u2207","nbsp;":"\u00A0","nbsp":"\u00A0","ndash;":"\u2013","ne;":"\u2260","ni;":"\u220B","not;":"\u00AC","not":"\u00AC","notin;":"\u2209","nsub;":"\u2284","Ntilde;":"\u00D1","Ntilde":"\u00D1","ntilde;":"\u00F1","ntilde":"\u00F1","Nu;":"\u039D","nu;":"\u03BD","Oacute;":"\u00D3","Oacute":"\u00D3","oacute;":"\u00F3","oacute":"\u00F3","Ocirc;":"\u00D4","Ocirc":"\u00D4","ocirc;":"\u00F4","ocirc":"\u00F4","OElig;":"\u0152","oelig;":"\u0153","Ograve;":"\u00D2","Ograve":"\u00D2","ograve;":"\u00F2","ograve":"\u00F2","oline;":"\u203E","Omega;":"\u03A9","omega;":"\u03C9","Omicron;":"\u039F","omicron;":"\u03BF","oplus;":"\u2295","or;":"\u2228","ordf;":"\u00AA","ordf":"\u00AA","ordm;":"\u00BA","ordm":"\u00BA","Oslash;":"\u00D8","Oslash":"\u00D8","oslash;":"\u00F8","oslash":"\u00F8","Otilde;":"\u00D5","Otilde":"\u00D5","otilde;":"\u00F5","otilde":"\u00F5","otimes;":"\u2297","Ouml;":"\u00D6","Ouml":"\u00D6","ouml;":"\u00F6","ouml":"\u00F6","para;":"\u00B6","para":"\u00B6","part;":"\u2202","permil;":"\u2030","perp;":"\u22A5","Phi;":"\u03A6","phi;":"\u03C6","Pi;":"\u03A0","pi;":"\u03C0","piv;":"\u03D6","plusmn;":"\u00B1","plusmn":"\u00B1","pound;":"\u00A3","pound":"\u00A3","prime;":"\u2032","Prime;":"\u2033","prod;":"\u220F","prop;":"\u221D","Psi;":"\u03A8","psi;":"\u03C8","quot":"\u0022","radic;":"\u221A","rang;":"\u27E9","raquo;":"\u00BB","raquo":"\u00BB","rarr;":"\u2192","rArr;":"\u21D2","rceil;":"\u2309","rdquo;":"\u201D","real;":"\u211C","reg;":"\u00AE","reg":"\u00AE","rfloor;":"\u230B","Rho;":"\u03A1","rho;":"\u03C1","rlm;":"\u200F","rsaquo;":"\u203A","rsquo;":"\u2019","sbquo;":"\u201A","Scaron;":"\u0160","scaron;":"\u0161","sdot;":"\u22C5","sect;":"\u00A7","sect":"\u00A7","shy;":"\u00AD","shy":"\u00AD","Sigma;":"\u03A3","sigma;":"\u03C3","sigmaf;":"\u03C2","sim;":"\u223C","spades;":"\u2660","sub;":"\u2282","sube;":"\u2286","sum;":"\u2211","sup1;":"\u00B9","sup1":"\u00B9","sup2;":"\u00B2","sup2":"\u00B2","sup3;":"\u00B3","sup3":"\u00B3","sup;":"\u2283","supe;":"\u2287","szlig;":"\u00DF","szlig":"\u00DF","Tau;":"\u03A4","tau;":"\u03C4","there4;":"\u2234","Theta;":"\u0398","theta;":"\u03B8","thetasym;":"\u03D1","thinsp;":"\u2009","THORN;":"\u00DE","THORN":"\u00DE","thorn;":"\u00FE","thorn":"\u00FE","tilde;":"\u02DC","times;":"\u00D7","times":"\u00D7","trade;":"\u2122","Uacute;":"\u00DA","Uacute":"\u00DA","uacute;":"\u00FA","uacute":"\u00FA","uarr;":"\u2191","uArr;":"\u21D1","Ucirc;":"\u00DB","Ucirc":"\u00DB","ucirc;":"\u00FB","ucirc":"\u00FB","Ugrave;":"\u00D9","Ugrave":"\u00D9","ugrave;":"\u00F9","ugrave":"\u00F9","uml;":"\u00A8","uml":"\u00A8","upsih;":"\u03D2","Upsilon;":"\u03A5","upsilon;":"\u03C5","Uuml;":"\u00DC","Uuml":"\u00DC","uuml;":"\u00FC","uuml":"\u00FC","weierp;":"\u2118","Xi;":"\u039E","xi;":"\u03BE","Yacute;":"\u00DD","Yacute":"\u00DD","yacute;":"\u00FD","yacute":"\u00FD","yen;":"\u00A5","yen":"\u00A5","yuml;":"\u00FF","yuml":"\u00FF","Yuml;":"\u0178","Zeta;":"\u0396","zeta;":"\u03B6","zwj;":"\u200D","zwnj;":"\u200C"} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/html5.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/html5.json deleted file mode 100644 index 61dd35aa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/html5.json +++ /dev/null @@ -1 +0,0 @@ -{"Abreve;":"\u0102","abreve;":"\u0103","ac;":"\u223E","acd;":"\u223F","acE;":"\u223E\u0333","Acy;":"\u0410","acy;":"\u0430","af;":"\u2061","Afr;":"\uD835\uDD04","afr;":"\uD835\uDD1E","aleph;":"\u2135","Amacr;":"\u0100","amacr;":"\u0101","amalg;":"\u2A3F","AMP;":"\u0026","AMP":"\u0026","andand;":"\u2A55","And;":"\u2A53","andd;":"\u2A5C","andslope;":"\u2A58","andv;":"\u2A5A","ange;":"\u29A4","angle;":"\u2220","angmsdaa;":"\u29A8","angmsdab;":"\u29A9","angmsdac;":"\u29AA","angmsdad;":"\u29AB","angmsdae;":"\u29AC","angmsdaf;":"\u29AD","angmsdag;":"\u29AE","angmsdah;":"\u29AF","angmsd;":"\u2221","angrt;":"\u221F","angrtvb;":"\u22BE","angrtvbd;":"\u299D","angsph;":"\u2222","angst;":"\u00C5","angzarr;":"\u237C","Aogon;":"\u0104","aogon;":"\u0105","Aopf;":"\uD835\uDD38","aopf;":"\uD835\uDD52","apacir;":"\u2A6F","ap;":"\u2248","apE;":"\u2A70","ape;":"\u224A","apid;":"\u224B","ApplyFunction;":"\u2061","approx;":"\u2248","approxeq;":"\u224A","Ascr;":"\uD835\uDC9C","ascr;":"\uD835\uDCB6","Assign;":"\u2254","ast;":"\u002A","asympeq;":"\u224D","awconint;":"\u2233","awint;":"\u2A11","backcong;":"\u224C","backepsilon;":"\u03F6","backprime;":"\u2035","backsim;":"\u223D","backsimeq;":"\u22CD","Backslash;":"\u2216","Barv;":"\u2AE7","barvee;":"\u22BD","barwed;":"\u2305","Barwed;":"\u2306","barwedge;":"\u2305","bbrk;":"\u23B5","bbrktbrk;":"\u23B6","bcong;":"\u224C","Bcy;":"\u0411","bcy;":"\u0431","becaus;":"\u2235","because;":"\u2235","Because;":"\u2235","bemptyv;":"\u29B0","bepsi;":"\u03F6","bernou;":"\u212C","Bernoullis;":"\u212C","beth;":"\u2136","between;":"\u226C","Bfr;":"\uD835\uDD05","bfr;":"\uD835\uDD1F","bigcap;":"\u22C2","bigcirc;":"\u25EF","bigcup;":"\u22C3","bigodot;":"\u2A00","bigoplus;":"\u2A01","bigotimes;":"\u2A02","bigsqcup;":"\u2A06","bigstar;":"\u2605","bigtriangledown;":"\u25BD","bigtriangleup;":"\u25B3","biguplus;":"\u2A04","bigvee;":"\u22C1","bigwedge;":"\u22C0","bkarow;":"\u290D","blacklozenge;":"\u29EB","blacksquare;":"\u25AA","blacktriangle;":"\u25B4","blacktriangledown;":"\u25BE","blacktriangleleft;":"\u25C2","blacktriangleright;":"\u25B8","blank;":"\u2423","blk12;":"\u2592","blk14;":"\u2591","blk34;":"\u2593","block;":"\u2588","bne;":"\u003D\u20E5","bnequiv;":"\u2261\u20E5","bNot;":"\u2AED","bnot;":"\u2310","Bopf;":"\uD835\uDD39","bopf;":"\uD835\uDD53","bot;":"\u22A5","bottom;":"\u22A5","bowtie;":"\u22C8","boxbox;":"\u29C9","boxdl;":"\u2510","boxdL;":"\u2555","boxDl;":"\u2556","boxDL;":"\u2557","boxdr;":"\u250C","boxdR;":"\u2552","boxDr;":"\u2553","boxDR;":"\u2554","boxh;":"\u2500","boxH;":"\u2550","boxhd;":"\u252C","boxHd;":"\u2564","boxhD;":"\u2565","boxHD;":"\u2566","boxhu;":"\u2534","boxHu;":"\u2567","boxhU;":"\u2568","boxHU;":"\u2569","boxminus;":"\u229F","boxplus;":"\u229E","boxtimes;":"\u22A0","boxul;":"\u2518","boxuL;":"\u255B","boxUl;":"\u255C","boxUL;":"\u255D","boxur;":"\u2514","boxuR;":"\u2558","boxUr;":"\u2559","boxUR;":"\u255A","boxv;":"\u2502","boxV;":"\u2551","boxvh;":"\u253C","boxvH;":"\u256A","boxVh;":"\u256B","boxVH;":"\u256C","boxvl;":"\u2524","boxvL;":"\u2561","boxVl;":"\u2562","boxVL;":"\u2563","boxvr;":"\u251C","boxvR;":"\u255E","boxVr;":"\u255F","boxVR;":"\u2560","bprime;":"\u2035","breve;":"\u02D8","Breve;":"\u02D8","bscr;":"\uD835\uDCB7","Bscr;":"\u212C","bsemi;":"\u204F","bsim;":"\u223D","bsime;":"\u22CD","bsolb;":"\u29C5","bsol;":"\u005C","bsolhsub;":"\u27C8","bullet;":"\u2022","bump;":"\u224E","bumpE;":"\u2AAE","bumpe;":"\u224F","Bumpeq;":"\u224E","bumpeq;":"\u224F","Cacute;":"\u0106","cacute;":"\u0107","capand;":"\u2A44","capbrcup;":"\u2A49","capcap;":"\u2A4B","Cap;":"\u22D2","capcup;":"\u2A47","capdot;":"\u2A40","CapitalDifferentialD;":"\u2145","caps;":"\u2229\uFE00","caret;":"\u2041","caron;":"\u02C7","Cayleys;":"\u212D","ccaps;":"\u2A4D","Ccaron;":"\u010C","ccaron;":"\u010D","Ccirc;":"\u0108","ccirc;":"\u0109","Cconint;":"\u2230","ccups;":"\u2A4C","ccupssm;":"\u2A50","Cdot;":"\u010A","cdot;":"\u010B","Cedilla;":"\u00B8","cemptyv;":"\u29B2","centerdot;":"\u00B7","CenterDot;":"\u00B7","cfr;":"\uD835\uDD20","Cfr;":"\u212D","CHcy;":"\u0427","chcy;":"\u0447","check;":"\u2713","checkmark;":"\u2713","circeq;":"\u2257","circlearrowleft;":"\u21BA","circlearrowright;":"\u21BB","circledast;":"\u229B","circledcirc;":"\u229A","circleddash;":"\u229D","CircleDot;":"\u2299","circledR;":"\u00AE","circledS;":"\u24C8","CircleMinus;":"\u2296","CirclePlus;":"\u2295","CircleTimes;":"\u2297","cir;":"\u25CB","cirE;":"\u29C3","cire;":"\u2257","cirfnint;":"\u2A10","cirmid;":"\u2AEF","cirscir;":"\u29C2","ClockwiseContourIntegral;":"\u2232","CloseCurlyDoubleQuote;":"\u201D","CloseCurlyQuote;":"\u2019","clubsuit;":"\u2663","colon;":"\u003A","Colon;":"\u2237","Colone;":"\u2A74","colone;":"\u2254","coloneq;":"\u2254","comma;":"\u002C","commat;":"\u0040","comp;":"\u2201","compfn;":"\u2218","complement;":"\u2201","complexes;":"\u2102","congdot;":"\u2A6D","Congruent;":"\u2261","conint;":"\u222E","Conint;":"\u222F","ContourIntegral;":"\u222E","copf;":"\uD835\uDD54","Copf;":"\u2102","coprod;":"\u2210","Coproduct;":"\u2210","COPY;":"\u00A9","COPY":"\u00A9","copysr;":"\u2117","CounterClockwiseContourIntegral;":"\u2233","cross;":"\u2717","Cross;":"\u2A2F","Cscr;":"\uD835\uDC9E","cscr;":"\uD835\uDCB8","csub;":"\u2ACF","csube;":"\u2AD1","csup;":"\u2AD0","csupe;":"\u2AD2","ctdot;":"\u22EF","cudarrl;":"\u2938","cudarrr;":"\u2935","cuepr;":"\u22DE","cuesc;":"\u22DF","cularr;":"\u21B6","cularrp;":"\u293D","cupbrcap;":"\u2A48","cupcap;":"\u2A46","CupCap;":"\u224D","Cup;":"\u22D3","cupcup;":"\u2A4A","cupdot;":"\u228D","cupor;":"\u2A45","cups;":"\u222A\uFE00","curarr;":"\u21B7","curarrm;":"\u293C","curlyeqprec;":"\u22DE","curlyeqsucc;":"\u22DF","curlyvee;":"\u22CE","curlywedge;":"\u22CF","curvearrowleft;":"\u21B6","curvearrowright;":"\u21B7","cuvee;":"\u22CE","cuwed;":"\u22CF","cwconint;":"\u2232","cwint;":"\u2231","cylcty;":"\u232D","daleth;":"\u2138","Darr;":"\u21A1","dash;":"\u2010","Dashv;":"\u2AE4","dashv;":"\u22A3","dbkarow;":"\u290F","dblac;":"\u02DD","Dcaron;":"\u010E","dcaron;":"\u010F","Dcy;":"\u0414","dcy;":"\u0434","ddagger;":"\u2021","ddarr;":"\u21CA","DD;":"\u2145","dd;":"\u2146","DDotrahd;":"\u2911","ddotseq;":"\u2A77","Del;":"\u2207","demptyv;":"\u29B1","dfisht;":"\u297F","Dfr;":"\uD835\uDD07","dfr;":"\uD835\uDD21","dHar;":"\u2965","dharl;":"\u21C3","dharr;":"\u21C2","DiacriticalAcute;":"\u00B4","DiacriticalDot;":"\u02D9","DiacriticalDoubleAcute;":"\u02DD","DiacriticalGrave;":"\u0060","DiacriticalTilde;":"\u02DC","diam;":"\u22C4","diamond;":"\u22C4","Diamond;":"\u22C4","diamondsuit;":"\u2666","die;":"\u00A8","DifferentialD;":"\u2146","digamma;":"\u03DD","disin;":"\u22F2","div;":"\u00F7","divideontimes;":"\u22C7","divonx;":"\u22C7","DJcy;":"\u0402","djcy;":"\u0452","dlcorn;":"\u231E","dlcrop;":"\u230D","dollar;":"\u0024","Dopf;":"\uD835\uDD3B","dopf;":"\uD835\uDD55","Dot;":"\u00A8","dot;":"\u02D9","DotDot;":"\u20DC","doteq;":"\u2250","doteqdot;":"\u2251","DotEqual;":"\u2250","dotminus;":"\u2238","dotplus;":"\u2214","dotsquare;":"\u22A1","doublebarwedge;":"\u2306","DoubleContourIntegral;":"\u222F","DoubleDot;":"\u00A8","DoubleDownArrow;":"\u21D3","DoubleLeftArrow;":"\u21D0","DoubleLeftRightArrow;":"\u21D4","DoubleLeftTee;":"\u2AE4","DoubleLongLeftArrow;":"\u27F8","DoubleLongLeftRightArrow;":"\u27FA","DoubleLongRightArrow;":"\u27F9","DoubleRightArrow;":"\u21D2","DoubleRightTee;":"\u22A8","DoubleUpArrow;":"\u21D1","DoubleUpDownArrow;":"\u21D5","DoubleVerticalBar;":"\u2225","DownArrowBar;":"\u2913","downarrow;":"\u2193","DownArrow;":"\u2193","Downarrow;":"\u21D3","DownArrowUpArrow;":"\u21F5","DownBreve;":"\u0311","downdownarrows;":"\u21CA","downharpoonleft;":"\u21C3","downharpoonright;":"\u21C2","DownLeftRightVector;":"\u2950","DownLeftTeeVector;":"\u295E","DownLeftVectorBar;":"\u2956","DownLeftVector;":"\u21BD","DownRightTeeVector;":"\u295F","DownRightVectorBar;":"\u2957","DownRightVector;":"\u21C1","DownTeeArrow;":"\u21A7","DownTee;":"\u22A4","drbkarow;":"\u2910","drcorn;":"\u231F","drcrop;":"\u230C","Dscr;":"\uD835\uDC9F","dscr;":"\uD835\uDCB9","DScy;":"\u0405","dscy;":"\u0455","dsol;":"\u29F6","Dstrok;":"\u0110","dstrok;":"\u0111","dtdot;":"\u22F1","dtri;":"\u25BF","dtrif;":"\u25BE","duarr;":"\u21F5","duhar;":"\u296F","dwangle;":"\u29A6","DZcy;":"\u040F","dzcy;":"\u045F","dzigrarr;":"\u27FF","easter;":"\u2A6E","Ecaron;":"\u011A","ecaron;":"\u011B","ecir;":"\u2256","ecolon;":"\u2255","Ecy;":"\u042D","ecy;":"\u044D","eDDot;":"\u2A77","Edot;":"\u0116","edot;":"\u0117","eDot;":"\u2251","ee;":"\u2147","efDot;":"\u2252","Efr;":"\uD835\uDD08","efr;":"\uD835\uDD22","eg;":"\u2A9A","egs;":"\u2A96","egsdot;":"\u2A98","el;":"\u2A99","Element;":"\u2208","elinters;":"\u23E7","ell;":"\u2113","els;":"\u2A95","elsdot;":"\u2A97","Emacr;":"\u0112","emacr;":"\u0113","emptyset;":"\u2205","EmptySmallSquare;":"\u25FB","emptyv;":"\u2205","EmptyVerySmallSquare;":"\u25AB","emsp13;":"\u2004","emsp14;":"\u2005","ENG;":"\u014A","eng;":"\u014B","Eogon;":"\u0118","eogon;":"\u0119","Eopf;":"\uD835\uDD3C","eopf;":"\uD835\uDD56","epar;":"\u22D5","eparsl;":"\u29E3","eplus;":"\u2A71","epsi;":"\u03B5","epsiv;":"\u03F5","eqcirc;":"\u2256","eqcolon;":"\u2255","eqsim;":"\u2242","eqslantgtr;":"\u2A96","eqslantless;":"\u2A95","Equal;":"\u2A75","equals;":"\u003D","EqualTilde;":"\u2242","equest;":"\u225F","Equilibrium;":"\u21CC","equivDD;":"\u2A78","eqvparsl;":"\u29E5","erarr;":"\u2971","erDot;":"\u2253","escr;":"\u212F","Escr;":"\u2130","esdot;":"\u2250","Esim;":"\u2A73","esim;":"\u2242","excl;":"\u0021","Exists;":"\u2203","expectation;":"\u2130","exponentiale;":"\u2147","ExponentialE;":"\u2147","fallingdotseq;":"\u2252","Fcy;":"\u0424","fcy;":"\u0444","female;":"\u2640","ffilig;":"\uFB03","fflig;":"\uFB00","ffllig;":"\uFB04","Ffr;":"\uD835\uDD09","ffr;":"\uD835\uDD23","filig;":"\uFB01","FilledSmallSquare;":"\u25FC","FilledVerySmallSquare;":"\u25AA","fjlig;":"\u0066\u006A","flat;":"\u266D","fllig;":"\uFB02","fltns;":"\u25B1","Fopf;":"\uD835\uDD3D","fopf;":"\uD835\uDD57","ForAll;":"\u2200","fork;":"\u22D4","forkv;":"\u2AD9","Fouriertrf;":"\u2131","fpartint;":"\u2A0D","frac13;":"\u2153","frac15;":"\u2155","frac16;":"\u2159","frac18;":"\u215B","frac23;":"\u2154","frac25;":"\u2156","frac35;":"\u2157","frac38;":"\u215C","frac45;":"\u2158","frac56;":"\u215A","frac58;":"\u215D","frac78;":"\u215E","frown;":"\u2322","fscr;":"\uD835\uDCBB","Fscr;":"\u2131","gacute;":"\u01F5","Gammad;":"\u03DC","gammad;":"\u03DD","gap;":"\u2A86","Gbreve;":"\u011E","gbreve;":"\u011F","Gcedil;":"\u0122","Gcirc;":"\u011C","gcirc;":"\u011D","Gcy;":"\u0413","gcy;":"\u0433","Gdot;":"\u0120","gdot;":"\u0121","gE;":"\u2267","gEl;":"\u2A8C","gel;":"\u22DB","geq;":"\u2265","geqq;":"\u2267","geqslant;":"\u2A7E","gescc;":"\u2AA9","ges;":"\u2A7E","gesdot;":"\u2A80","gesdoto;":"\u2A82","gesdotol;":"\u2A84","gesl;":"\u22DB\uFE00","gesles;":"\u2A94","Gfr;":"\uD835\uDD0A","gfr;":"\uD835\uDD24","gg;":"\u226B","Gg;":"\u22D9","ggg;":"\u22D9","gimel;":"\u2137","GJcy;":"\u0403","gjcy;":"\u0453","gla;":"\u2AA5","gl;":"\u2277","glE;":"\u2A92","glj;":"\u2AA4","gnap;":"\u2A8A","gnapprox;":"\u2A8A","gne;":"\u2A88","gnE;":"\u2269","gneq;":"\u2A88","gneqq;":"\u2269","gnsim;":"\u22E7","Gopf;":"\uD835\uDD3E","gopf;":"\uD835\uDD58","grave;":"\u0060","GreaterEqual;":"\u2265","GreaterEqualLess;":"\u22DB","GreaterFullEqual;":"\u2267","GreaterGreater;":"\u2AA2","GreaterLess;":"\u2277","GreaterSlantEqual;":"\u2A7E","GreaterTilde;":"\u2273","Gscr;":"\uD835\uDCA2","gscr;":"\u210A","gsim;":"\u2273","gsime;":"\u2A8E","gsiml;":"\u2A90","gtcc;":"\u2AA7","gtcir;":"\u2A7A","GT;":"\u003E","GT":"\u003E","Gt;":"\u226B","gtdot;":"\u22D7","gtlPar;":"\u2995","gtquest;":"\u2A7C","gtrapprox;":"\u2A86","gtrarr;":"\u2978","gtrdot;":"\u22D7","gtreqless;":"\u22DB","gtreqqless;":"\u2A8C","gtrless;":"\u2277","gtrsim;":"\u2273","gvertneqq;":"\u2269\uFE00","gvnE;":"\u2269\uFE00","Hacek;":"\u02C7","hairsp;":"\u200A","half;":"\u00BD","hamilt;":"\u210B","HARDcy;":"\u042A","hardcy;":"\u044A","harrcir;":"\u2948","harrw;":"\u21AD","Hat;":"\u005E","hbar;":"\u210F","Hcirc;":"\u0124","hcirc;":"\u0125","heartsuit;":"\u2665","hercon;":"\u22B9","hfr;":"\uD835\uDD25","Hfr;":"\u210C","HilbertSpace;":"\u210B","hksearow;":"\u2925","hkswarow;":"\u2926","hoarr;":"\u21FF","homtht;":"\u223B","hookleftarrow;":"\u21A9","hookrightarrow;":"\u21AA","hopf;":"\uD835\uDD59","Hopf;":"\u210D","horbar;":"\u2015","HorizontalLine;":"\u2500","hscr;":"\uD835\uDCBD","Hscr;":"\u210B","hslash;":"\u210F","Hstrok;":"\u0126","hstrok;":"\u0127","HumpDownHump;":"\u224E","HumpEqual;":"\u224F","hybull;":"\u2043","hyphen;":"\u2010","ic;":"\u2063","Icy;":"\u0418","icy;":"\u0438","Idot;":"\u0130","IEcy;":"\u0415","iecy;":"\u0435","iff;":"\u21D4","ifr;":"\uD835\uDD26","Ifr;":"\u2111","ii;":"\u2148","iiiint;":"\u2A0C","iiint;":"\u222D","iinfin;":"\u29DC","iiota;":"\u2129","IJlig;":"\u0132","ijlig;":"\u0133","Imacr;":"\u012A","imacr;":"\u012B","ImaginaryI;":"\u2148","imagline;":"\u2110","imagpart;":"\u2111","imath;":"\u0131","Im;":"\u2111","imof;":"\u22B7","imped;":"\u01B5","Implies;":"\u21D2","incare;":"\u2105","in;":"\u2208","infintie;":"\u29DD","inodot;":"\u0131","intcal;":"\u22BA","Int;":"\u222C","integers;":"\u2124","Integral;":"\u222B","intercal;":"\u22BA","Intersection;":"\u22C2","intlarhk;":"\u2A17","intprod;":"\u2A3C","InvisibleComma;":"\u2063","InvisibleTimes;":"\u2062","IOcy;":"\u0401","iocy;":"\u0451","Iogon;":"\u012E","iogon;":"\u012F","Iopf;":"\uD835\uDD40","iopf;":"\uD835\uDD5A","iprod;":"\u2A3C","iscr;":"\uD835\uDCBE","Iscr;":"\u2110","isindot;":"\u22F5","isinE;":"\u22F9","isins;":"\u22F4","isinsv;":"\u22F3","isinv;":"\u2208","it;":"\u2062","Itilde;":"\u0128","itilde;":"\u0129","Iukcy;":"\u0406","iukcy;":"\u0456","Jcirc;":"\u0134","jcirc;":"\u0135","Jcy;":"\u0419","jcy;":"\u0439","Jfr;":"\uD835\uDD0D","jfr;":"\uD835\uDD27","jmath;":"\u0237","Jopf;":"\uD835\uDD41","jopf;":"\uD835\uDD5B","Jscr;":"\uD835\uDCA5","jscr;":"\uD835\uDCBF","Jsercy;":"\u0408","jsercy;":"\u0458","Jukcy;":"\u0404","jukcy;":"\u0454","kappav;":"\u03F0","Kcedil;":"\u0136","kcedil;":"\u0137","Kcy;":"\u041A","kcy;":"\u043A","Kfr;":"\uD835\uDD0E","kfr;":"\uD835\uDD28","kgreen;":"\u0138","KHcy;":"\u0425","khcy;":"\u0445","KJcy;":"\u040C","kjcy;":"\u045C","Kopf;":"\uD835\uDD42","kopf;":"\uD835\uDD5C","Kscr;":"\uD835\uDCA6","kscr;":"\uD835\uDCC0","lAarr;":"\u21DA","Lacute;":"\u0139","lacute;":"\u013A","laemptyv;":"\u29B4","lagran;":"\u2112","Lang;":"\u27EA","langd;":"\u2991","langle;":"\u27E8","lap;":"\u2A85","Laplacetrf;":"\u2112","larrb;":"\u21E4","larrbfs;":"\u291F","Larr;":"\u219E","larrfs;":"\u291D","larrhk;":"\u21A9","larrlp;":"\u21AB","larrpl;":"\u2939","larrsim;":"\u2973","larrtl;":"\u21A2","latail;":"\u2919","lAtail;":"\u291B","lat;":"\u2AAB","late;":"\u2AAD","lates;":"\u2AAD\uFE00","lbarr;":"\u290C","lBarr;":"\u290E","lbbrk;":"\u2772","lbrace;":"\u007B","lbrack;":"\u005B","lbrke;":"\u298B","lbrksld;":"\u298F","lbrkslu;":"\u298D","Lcaron;":"\u013D","lcaron;":"\u013E","Lcedil;":"\u013B","lcedil;":"\u013C","lcub;":"\u007B","Lcy;":"\u041B","lcy;":"\u043B","ldca;":"\u2936","ldquor;":"\u201E","ldrdhar;":"\u2967","ldrushar;":"\u294B","ldsh;":"\u21B2","lE;":"\u2266","LeftAngleBracket;":"\u27E8","LeftArrowBar;":"\u21E4","leftarrow;":"\u2190","LeftArrow;":"\u2190","Leftarrow;":"\u21D0","LeftArrowRightArrow;":"\u21C6","leftarrowtail;":"\u21A2","LeftCeiling;":"\u2308","LeftDoubleBracket;":"\u27E6","LeftDownTeeVector;":"\u2961","LeftDownVectorBar;":"\u2959","LeftDownVector;":"\u21C3","LeftFloor;":"\u230A","leftharpoondown;":"\u21BD","leftharpoonup;":"\u21BC","leftleftarrows;":"\u21C7","leftrightarrow;":"\u2194","LeftRightArrow;":"\u2194","Leftrightarrow;":"\u21D4","leftrightarrows;":"\u21C6","leftrightharpoons;":"\u21CB","leftrightsquigarrow;":"\u21AD","LeftRightVector;":"\u294E","LeftTeeArrow;":"\u21A4","LeftTee;":"\u22A3","LeftTeeVector;":"\u295A","leftthreetimes;":"\u22CB","LeftTriangleBar;":"\u29CF","LeftTriangle;":"\u22B2","LeftTriangleEqual;":"\u22B4","LeftUpDownVector;":"\u2951","LeftUpTeeVector;":"\u2960","LeftUpVectorBar;":"\u2958","LeftUpVector;":"\u21BF","LeftVectorBar;":"\u2952","LeftVector;":"\u21BC","lEg;":"\u2A8B","leg;":"\u22DA","leq;":"\u2264","leqq;":"\u2266","leqslant;":"\u2A7D","lescc;":"\u2AA8","les;":"\u2A7D","lesdot;":"\u2A7F","lesdoto;":"\u2A81","lesdotor;":"\u2A83","lesg;":"\u22DA\uFE00","lesges;":"\u2A93","lessapprox;":"\u2A85","lessdot;":"\u22D6","lesseqgtr;":"\u22DA","lesseqqgtr;":"\u2A8B","LessEqualGreater;":"\u22DA","LessFullEqual;":"\u2266","LessGreater;":"\u2276","lessgtr;":"\u2276","LessLess;":"\u2AA1","lesssim;":"\u2272","LessSlantEqual;":"\u2A7D","LessTilde;":"\u2272","lfisht;":"\u297C","Lfr;":"\uD835\uDD0F","lfr;":"\uD835\uDD29","lg;":"\u2276","lgE;":"\u2A91","lHar;":"\u2962","lhard;":"\u21BD","lharu;":"\u21BC","lharul;":"\u296A","lhblk;":"\u2584","LJcy;":"\u0409","ljcy;":"\u0459","llarr;":"\u21C7","ll;":"\u226A","Ll;":"\u22D8","llcorner;":"\u231E","Lleftarrow;":"\u21DA","llhard;":"\u296B","lltri;":"\u25FA","Lmidot;":"\u013F","lmidot;":"\u0140","lmoustache;":"\u23B0","lmoust;":"\u23B0","lnap;":"\u2A89","lnapprox;":"\u2A89","lne;":"\u2A87","lnE;":"\u2268","lneq;":"\u2A87","lneqq;":"\u2268","lnsim;":"\u22E6","loang;":"\u27EC","loarr;":"\u21FD","lobrk;":"\u27E6","longleftarrow;":"\u27F5","LongLeftArrow;":"\u27F5","Longleftarrow;":"\u27F8","longleftrightarrow;":"\u27F7","LongLeftRightArrow;":"\u27F7","Longleftrightarrow;":"\u27FA","longmapsto;":"\u27FC","longrightarrow;":"\u27F6","LongRightArrow;":"\u27F6","Longrightarrow;":"\u27F9","looparrowleft;":"\u21AB","looparrowright;":"\u21AC","lopar;":"\u2985","Lopf;":"\uD835\uDD43","lopf;":"\uD835\uDD5D","loplus;":"\u2A2D","lotimes;":"\u2A34","lowbar;":"\u005F","LowerLeftArrow;":"\u2199","LowerRightArrow;":"\u2198","lozenge;":"\u25CA","lozf;":"\u29EB","lpar;":"\u0028","lparlt;":"\u2993","lrarr;":"\u21C6","lrcorner;":"\u231F","lrhar;":"\u21CB","lrhard;":"\u296D","lrtri;":"\u22BF","lscr;":"\uD835\uDCC1","Lscr;":"\u2112","lsh;":"\u21B0","Lsh;":"\u21B0","lsim;":"\u2272","lsime;":"\u2A8D","lsimg;":"\u2A8F","lsqb;":"\u005B","lsquor;":"\u201A","Lstrok;":"\u0141","lstrok;":"\u0142","ltcc;":"\u2AA6","ltcir;":"\u2A79","LT;":"\u003C","LT":"\u003C","Lt;":"\u226A","ltdot;":"\u22D6","lthree;":"\u22CB","ltimes;":"\u22C9","ltlarr;":"\u2976","ltquest;":"\u2A7B","ltri;":"\u25C3","ltrie;":"\u22B4","ltrif;":"\u25C2","ltrPar;":"\u2996","lurdshar;":"\u294A","luruhar;":"\u2966","lvertneqq;":"\u2268\uFE00","lvnE;":"\u2268\uFE00","male;":"\u2642","malt;":"\u2720","maltese;":"\u2720","Map;":"\u2905","map;":"\u21A6","mapsto;":"\u21A6","mapstodown;":"\u21A7","mapstoleft;":"\u21A4","mapstoup;":"\u21A5","marker;":"\u25AE","mcomma;":"\u2A29","Mcy;":"\u041C","mcy;":"\u043C","mDDot;":"\u223A","measuredangle;":"\u2221","MediumSpace;":"\u205F","Mellintrf;":"\u2133","Mfr;":"\uD835\uDD10","mfr;":"\uD835\uDD2A","mho;":"\u2127","midast;":"\u002A","midcir;":"\u2AF0","mid;":"\u2223","minusb;":"\u229F","minusd;":"\u2238","minusdu;":"\u2A2A","MinusPlus;":"\u2213","mlcp;":"\u2ADB","mldr;":"\u2026","mnplus;":"\u2213","models;":"\u22A7","Mopf;":"\uD835\uDD44","mopf;":"\uD835\uDD5E","mp;":"\u2213","mscr;":"\uD835\uDCC2","Mscr;":"\u2133","mstpos;":"\u223E","multimap;":"\u22B8","mumap;":"\u22B8","Nacute;":"\u0143","nacute;":"\u0144","nang;":"\u2220\u20D2","nap;":"\u2249","napE;":"\u2A70\u0338","napid;":"\u224B\u0338","napos;":"\u0149","napprox;":"\u2249","natural;":"\u266E","naturals;":"\u2115","natur;":"\u266E","nbump;":"\u224E\u0338","nbumpe;":"\u224F\u0338","ncap;":"\u2A43","Ncaron;":"\u0147","ncaron;":"\u0148","Ncedil;":"\u0145","ncedil;":"\u0146","ncong;":"\u2247","ncongdot;":"\u2A6D\u0338","ncup;":"\u2A42","Ncy;":"\u041D","ncy;":"\u043D","nearhk;":"\u2924","nearr;":"\u2197","neArr;":"\u21D7","nearrow;":"\u2197","nedot;":"\u2250\u0338","NegativeMediumSpace;":"\u200B","NegativeThickSpace;":"\u200B","NegativeThinSpace;":"\u200B","NegativeVeryThinSpace;":"\u200B","nequiv;":"\u2262","nesear;":"\u2928","nesim;":"\u2242\u0338","NestedGreaterGreater;":"\u226B","NestedLessLess;":"\u226A","NewLine;":"\u000A","nexist;":"\u2204","nexists;":"\u2204","Nfr;":"\uD835\uDD11","nfr;":"\uD835\uDD2B","ngE;":"\u2267\u0338","nge;":"\u2271","ngeq;":"\u2271","ngeqq;":"\u2267\u0338","ngeqslant;":"\u2A7E\u0338","nges;":"\u2A7E\u0338","nGg;":"\u22D9\u0338","ngsim;":"\u2275","nGt;":"\u226B\u20D2","ngt;":"\u226F","ngtr;":"\u226F","nGtv;":"\u226B\u0338","nharr;":"\u21AE","nhArr;":"\u21CE","nhpar;":"\u2AF2","nis;":"\u22FC","nisd;":"\u22FA","niv;":"\u220B","NJcy;":"\u040A","njcy;":"\u045A","nlarr;":"\u219A","nlArr;":"\u21CD","nldr;":"\u2025","nlE;":"\u2266\u0338","nle;":"\u2270","nleftarrow;":"\u219A","nLeftarrow;":"\u21CD","nleftrightarrow;":"\u21AE","nLeftrightarrow;":"\u21CE","nleq;":"\u2270","nleqq;":"\u2266\u0338","nleqslant;":"\u2A7D\u0338","nles;":"\u2A7D\u0338","nless;":"\u226E","nLl;":"\u22D8\u0338","nlsim;":"\u2274","nLt;":"\u226A\u20D2","nlt;":"\u226E","nltri;":"\u22EA","nltrie;":"\u22EC","nLtv;":"\u226A\u0338","nmid;":"\u2224","NoBreak;":"\u2060","NonBreakingSpace;":"\u00A0","nopf;":"\uD835\uDD5F","Nopf;":"\u2115","Not;":"\u2AEC","NotCongruent;":"\u2262","NotCupCap;":"\u226D","NotDoubleVerticalBar;":"\u2226","NotElement;":"\u2209","NotEqual;":"\u2260","NotEqualTilde;":"\u2242\u0338","NotExists;":"\u2204","NotGreater;":"\u226F","NotGreaterEqual;":"\u2271","NotGreaterFullEqual;":"\u2267\u0338","NotGreaterGreater;":"\u226B\u0338","NotGreaterLess;":"\u2279","NotGreaterSlantEqual;":"\u2A7E\u0338","NotGreaterTilde;":"\u2275","NotHumpDownHump;":"\u224E\u0338","NotHumpEqual;":"\u224F\u0338","notindot;":"\u22F5\u0338","notinE;":"\u22F9\u0338","notinva;":"\u2209","notinvb;":"\u22F7","notinvc;":"\u22F6","NotLeftTriangleBar;":"\u29CF\u0338","NotLeftTriangle;":"\u22EA","NotLeftTriangleEqual;":"\u22EC","NotLess;":"\u226E","NotLessEqual;":"\u2270","NotLessGreater;":"\u2278","NotLessLess;":"\u226A\u0338","NotLessSlantEqual;":"\u2A7D\u0338","NotLessTilde;":"\u2274","NotNestedGreaterGreater;":"\u2AA2\u0338","NotNestedLessLess;":"\u2AA1\u0338","notni;":"\u220C","notniva;":"\u220C","notnivb;":"\u22FE","notnivc;":"\u22FD","NotPrecedes;":"\u2280","NotPrecedesEqual;":"\u2AAF\u0338","NotPrecedesSlantEqual;":"\u22E0","NotReverseElement;":"\u220C","NotRightTriangleBar;":"\u29D0\u0338","NotRightTriangle;":"\u22EB","NotRightTriangleEqual;":"\u22ED","NotSquareSubset;":"\u228F\u0338","NotSquareSubsetEqual;":"\u22E2","NotSquareSuperset;":"\u2290\u0338","NotSquareSupersetEqual;":"\u22E3","NotSubset;":"\u2282\u20D2","NotSubsetEqual;":"\u2288","NotSucceeds;":"\u2281","NotSucceedsEqual;":"\u2AB0\u0338","NotSucceedsSlantEqual;":"\u22E1","NotSucceedsTilde;":"\u227F\u0338","NotSuperset;":"\u2283\u20D2","NotSupersetEqual;":"\u2289","NotTilde;":"\u2241","NotTildeEqual;":"\u2244","NotTildeFullEqual;":"\u2247","NotTildeTilde;":"\u2249","NotVerticalBar;":"\u2224","nparallel;":"\u2226","npar;":"\u2226","nparsl;":"\u2AFD\u20E5","npart;":"\u2202\u0338","npolint;":"\u2A14","npr;":"\u2280","nprcue;":"\u22E0","nprec;":"\u2280","npreceq;":"\u2AAF\u0338","npre;":"\u2AAF\u0338","nrarrc;":"\u2933\u0338","nrarr;":"\u219B","nrArr;":"\u21CF","nrarrw;":"\u219D\u0338","nrightarrow;":"\u219B","nRightarrow;":"\u21CF","nrtri;":"\u22EB","nrtrie;":"\u22ED","nsc;":"\u2281","nsccue;":"\u22E1","nsce;":"\u2AB0\u0338","Nscr;":"\uD835\uDCA9","nscr;":"\uD835\uDCC3","nshortmid;":"\u2224","nshortparallel;":"\u2226","nsim;":"\u2241","nsime;":"\u2244","nsimeq;":"\u2244","nsmid;":"\u2224","nspar;":"\u2226","nsqsube;":"\u22E2","nsqsupe;":"\u22E3","nsubE;":"\u2AC5\u0338","nsube;":"\u2288","nsubset;":"\u2282\u20D2","nsubseteq;":"\u2288","nsubseteqq;":"\u2AC5\u0338","nsucc;":"\u2281","nsucceq;":"\u2AB0\u0338","nsup;":"\u2285","nsupE;":"\u2AC6\u0338","nsupe;":"\u2289","nsupset;":"\u2283\u20D2","nsupseteq;":"\u2289","nsupseteqq;":"\u2AC6\u0338","ntgl;":"\u2279","ntlg;":"\u2278","ntriangleleft;":"\u22EA","ntrianglelefteq;":"\u22EC","ntriangleright;":"\u22EB","ntrianglerighteq;":"\u22ED","num;":"\u0023","numero;":"\u2116","numsp;":"\u2007","nvap;":"\u224D\u20D2","nvdash;":"\u22AC","nvDash;":"\u22AD","nVdash;":"\u22AE","nVDash;":"\u22AF","nvge;":"\u2265\u20D2","nvgt;":"\u003E\u20D2","nvHarr;":"\u2904","nvinfin;":"\u29DE","nvlArr;":"\u2902","nvle;":"\u2264\u20D2","nvlt;":"\u003C\u20D2","nvltrie;":"\u22B4\u20D2","nvrArr;":"\u2903","nvrtrie;":"\u22B5\u20D2","nvsim;":"\u223C\u20D2","nwarhk;":"\u2923","nwarr;":"\u2196","nwArr;":"\u21D6","nwarrow;":"\u2196","nwnear;":"\u2927","oast;":"\u229B","ocir;":"\u229A","Ocy;":"\u041E","ocy;":"\u043E","odash;":"\u229D","Odblac;":"\u0150","odblac;":"\u0151","odiv;":"\u2A38","odot;":"\u2299","odsold;":"\u29BC","ofcir;":"\u29BF","Ofr;":"\uD835\uDD12","ofr;":"\uD835\uDD2C","ogon;":"\u02DB","ogt;":"\u29C1","ohbar;":"\u29B5","ohm;":"\u03A9","oint;":"\u222E","olarr;":"\u21BA","olcir;":"\u29BE","olcross;":"\u29BB","olt;":"\u29C0","Omacr;":"\u014C","omacr;":"\u014D","omid;":"\u29B6","ominus;":"\u2296","Oopf;":"\uD835\uDD46","oopf;":"\uD835\uDD60","opar;":"\u29B7","OpenCurlyDoubleQuote;":"\u201C","OpenCurlyQuote;":"\u2018","operp;":"\u29B9","orarr;":"\u21BB","Or;":"\u2A54","ord;":"\u2A5D","order;":"\u2134","orderof;":"\u2134","origof;":"\u22B6","oror;":"\u2A56","orslope;":"\u2A57","orv;":"\u2A5B","oS;":"\u24C8","Oscr;":"\uD835\uDCAA","oscr;":"\u2134","osol;":"\u2298","otimesas;":"\u2A36","Otimes;":"\u2A37","ovbar;":"\u233D","OverBar;":"\u203E","OverBrace;":"\u23DE","OverBracket;":"\u23B4","OverParenthesis;":"\u23DC","parallel;":"\u2225","par;":"\u2225","parsim;":"\u2AF3","parsl;":"\u2AFD","PartialD;":"\u2202","Pcy;":"\u041F","pcy;":"\u043F","percnt;":"\u0025","period;":"\u002E","pertenk;":"\u2031","Pfr;":"\uD835\uDD13","pfr;":"\uD835\uDD2D","phiv;":"\u03D5","phmmat;":"\u2133","phone;":"\u260E","pitchfork;":"\u22D4","planck;":"\u210F","planckh;":"\u210E","plankv;":"\u210F","plusacir;":"\u2A23","plusb;":"\u229E","pluscir;":"\u2A22","plus;":"\u002B","plusdo;":"\u2214","plusdu;":"\u2A25","pluse;":"\u2A72","PlusMinus;":"\u00B1","plussim;":"\u2A26","plustwo;":"\u2A27","pm;":"\u00B1","Poincareplane;":"\u210C","pointint;":"\u2A15","popf;":"\uD835\uDD61","Popf;":"\u2119","prap;":"\u2AB7","Pr;":"\u2ABB","pr;":"\u227A","prcue;":"\u227C","precapprox;":"\u2AB7","prec;":"\u227A","preccurlyeq;":"\u227C","Precedes;":"\u227A","PrecedesEqual;":"\u2AAF","PrecedesSlantEqual;":"\u227C","PrecedesTilde;":"\u227E","preceq;":"\u2AAF","precnapprox;":"\u2AB9","precneqq;":"\u2AB5","precnsim;":"\u22E8","pre;":"\u2AAF","prE;":"\u2AB3","precsim;":"\u227E","primes;":"\u2119","prnap;":"\u2AB9","prnE;":"\u2AB5","prnsim;":"\u22E8","Product;":"\u220F","profalar;":"\u232E","profline;":"\u2312","profsurf;":"\u2313","Proportional;":"\u221D","Proportion;":"\u2237","propto;":"\u221D","prsim;":"\u227E","prurel;":"\u22B0","Pscr;":"\uD835\uDCAB","pscr;":"\uD835\uDCC5","puncsp;":"\u2008","Qfr;":"\uD835\uDD14","qfr;":"\uD835\uDD2E","qint;":"\u2A0C","qopf;":"\uD835\uDD62","Qopf;":"\u211A","qprime;":"\u2057","Qscr;":"\uD835\uDCAC","qscr;":"\uD835\uDCC6","quaternions;":"\u210D","quatint;":"\u2A16","quest;":"\u003F","questeq;":"\u225F","QUOT;":"\u0022","QUOT":"\u0022","rAarr;":"\u21DB","race;":"\u223D\u0331","Racute;":"\u0154","racute;":"\u0155","raemptyv;":"\u29B3","Rang;":"\u27EB","rangd;":"\u2992","range;":"\u29A5","rangle;":"\u27E9","rarrap;":"\u2975","rarrb;":"\u21E5","rarrbfs;":"\u2920","rarrc;":"\u2933","Rarr;":"\u21A0","rarrfs;":"\u291E","rarrhk;":"\u21AA","rarrlp;":"\u21AC","rarrpl;":"\u2945","rarrsim;":"\u2974","Rarrtl;":"\u2916","rarrtl;":"\u21A3","rarrw;":"\u219D","ratail;":"\u291A","rAtail;":"\u291C","ratio;":"\u2236","rationals;":"\u211A","rbarr;":"\u290D","rBarr;":"\u290F","RBarr;":"\u2910","rbbrk;":"\u2773","rbrace;":"\u007D","rbrack;":"\u005D","rbrke;":"\u298C","rbrksld;":"\u298E","rbrkslu;":"\u2990","Rcaron;":"\u0158","rcaron;":"\u0159","Rcedil;":"\u0156","rcedil;":"\u0157","rcub;":"\u007D","Rcy;":"\u0420","rcy;":"\u0440","rdca;":"\u2937","rdldhar;":"\u2969","rdquor;":"\u201D","rdsh;":"\u21B3","realine;":"\u211B","realpart;":"\u211C","reals;":"\u211D","Re;":"\u211C","rect;":"\u25AD","REG;":"\u00AE","REG":"\u00AE","ReverseElement;":"\u220B","ReverseEquilibrium;":"\u21CB","ReverseUpEquilibrium;":"\u296F","rfisht;":"\u297D","rfr;":"\uD835\uDD2F","Rfr;":"\u211C","rHar;":"\u2964","rhard;":"\u21C1","rharu;":"\u21C0","rharul;":"\u296C","rhov;":"\u03F1","RightAngleBracket;":"\u27E9","RightArrowBar;":"\u21E5","rightarrow;":"\u2192","RightArrow;":"\u2192","Rightarrow;":"\u21D2","RightArrowLeftArrow;":"\u21C4","rightarrowtail;":"\u21A3","RightCeiling;":"\u2309","RightDoubleBracket;":"\u27E7","RightDownTeeVector;":"\u295D","RightDownVectorBar;":"\u2955","RightDownVector;":"\u21C2","RightFloor;":"\u230B","rightharpoondown;":"\u21C1","rightharpoonup;":"\u21C0","rightleftarrows;":"\u21C4","rightleftharpoons;":"\u21CC","rightrightarrows;":"\u21C9","rightsquigarrow;":"\u219D","RightTeeArrow;":"\u21A6","RightTee;":"\u22A2","RightTeeVector;":"\u295B","rightthreetimes;":"\u22CC","RightTriangleBar;":"\u29D0","RightTriangle;":"\u22B3","RightTriangleEqual;":"\u22B5","RightUpDownVector;":"\u294F","RightUpTeeVector;":"\u295C","RightUpVectorBar;":"\u2954","RightUpVector;":"\u21BE","RightVectorBar;":"\u2953","RightVector;":"\u21C0","ring;":"\u02DA","risingdotseq;":"\u2253","rlarr;":"\u21C4","rlhar;":"\u21CC","rmoustache;":"\u23B1","rmoust;":"\u23B1","rnmid;":"\u2AEE","roang;":"\u27ED","roarr;":"\u21FE","robrk;":"\u27E7","ropar;":"\u2986","ropf;":"\uD835\uDD63","Ropf;":"\u211D","roplus;":"\u2A2E","rotimes;":"\u2A35","RoundImplies;":"\u2970","rpar;":"\u0029","rpargt;":"\u2994","rppolint;":"\u2A12","rrarr;":"\u21C9","Rrightarrow;":"\u21DB","rscr;":"\uD835\uDCC7","Rscr;":"\u211B","rsh;":"\u21B1","Rsh;":"\u21B1","rsqb;":"\u005D","rsquor;":"\u2019","rthree;":"\u22CC","rtimes;":"\u22CA","rtri;":"\u25B9","rtrie;":"\u22B5","rtrif;":"\u25B8","rtriltri;":"\u29CE","RuleDelayed;":"\u29F4","ruluhar;":"\u2968","rx;":"\u211E","Sacute;":"\u015A","sacute;":"\u015B","scap;":"\u2AB8","Sc;":"\u2ABC","sc;":"\u227B","sccue;":"\u227D","sce;":"\u2AB0","scE;":"\u2AB4","Scedil;":"\u015E","scedil;":"\u015F","Scirc;":"\u015C","scirc;":"\u015D","scnap;":"\u2ABA","scnE;":"\u2AB6","scnsim;":"\u22E9","scpolint;":"\u2A13","scsim;":"\u227F","Scy;":"\u0421","scy;":"\u0441","sdotb;":"\u22A1","sdote;":"\u2A66","searhk;":"\u2925","searr;":"\u2198","seArr;":"\u21D8","searrow;":"\u2198","semi;":"\u003B","seswar;":"\u2929","setminus;":"\u2216","setmn;":"\u2216","sext;":"\u2736","Sfr;":"\uD835\uDD16","sfr;":"\uD835\uDD30","sfrown;":"\u2322","sharp;":"\u266F","SHCHcy;":"\u0429","shchcy;":"\u0449","SHcy;":"\u0428","shcy;":"\u0448","ShortDownArrow;":"\u2193","ShortLeftArrow;":"\u2190","shortmid;":"\u2223","shortparallel;":"\u2225","ShortRightArrow;":"\u2192","ShortUpArrow;":"\u2191","sigmav;":"\u03C2","simdot;":"\u2A6A","sime;":"\u2243","simeq;":"\u2243","simg;":"\u2A9E","simgE;":"\u2AA0","siml;":"\u2A9D","simlE;":"\u2A9F","simne;":"\u2246","simplus;":"\u2A24","simrarr;":"\u2972","slarr;":"\u2190","SmallCircle;":"\u2218","smallsetminus;":"\u2216","smashp;":"\u2A33","smeparsl;":"\u29E4","smid;":"\u2223","smile;":"\u2323","smt;":"\u2AAA","smte;":"\u2AAC","smtes;":"\u2AAC\uFE00","SOFTcy;":"\u042C","softcy;":"\u044C","solbar;":"\u233F","solb;":"\u29C4","sol;":"\u002F","Sopf;":"\uD835\uDD4A","sopf;":"\uD835\uDD64","spadesuit;":"\u2660","spar;":"\u2225","sqcap;":"\u2293","sqcaps;":"\u2293\uFE00","sqcup;":"\u2294","sqcups;":"\u2294\uFE00","Sqrt;":"\u221A","sqsub;":"\u228F","sqsube;":"\u2291","sqsubset;":"\u228F","sqsubseteq;":"\u2291","sqsup;":"\u2290","sqsupe;":"\u2292","sqsupset;":"\u2290","sqsupseteq;":"\u2292","square;":"\u25A1","Square;":"\u25A1","SquareIntersection;":"\u2293","SquareSubset;":"\u228F","SquareSubsetEqual;":"\u2291","SquareSuperset;":"\u2290","SquareSupersetEqual;":"\u2292","SquareUnion;":"\u2294","squarf;":"\u25AA","squ;":"\u25A1","squf;":"\u25AA","srarr;":"\u2192","Sscr;":"\uD835\uDCAE","sscr;":"\uD835\uDCC8","ssetmn;":"\u2216","ssmile;":"\u2323","sstarf;":"\u22C6","Star;":"\u22C6","star;":"\u2606","starf;":"\u2605","straightepsilon;":"\u03F5","straightphi;":"\u03D5","strns;":"\u00AF","Sub;":"\u22D0","subdot;":"\u2ABD","subE;":"\u2AC5","subedot;":"\u2AC3","submult;":"\u2AC1","subnE;":"\u2ACB","subne;":"\u228A","subplus;":"\u2ABF","subrarr;":"\u2979","subset;":"\u2282","Subset;":"\u22D0","subseteq;":"\u2286","subseteqq;":"\u2AC5","SubsetEqual;":"\u2286","subsetneq;":"\u228A","subsetneqq;":"\u2ACB","subsim;":"\u2AC7","subsub;":"\u2AD5","subsup;":"\u2AD3","succapprox;":"\u2AB8","succ;":"\u227B","succcurlyeq;":"\u227D","Succeeds;":"\u227B","SucceedsEqual;":"\u2AB0","SucceedsSlantEqual;":"\u227D","SucceedsTilde;":"\u227F","succeq;":"\u2AB0","succnapprox;":"\u2ABA","succneqq;":"\u2AB6","succnsim;":"\u22E9","succsim;":"\u227F","SuchThat;":"\u220B","Sum;":"\u2211","sung;":"\u266A","Sup;":"\u22D1","supdot;":"\u2ABE","supdsub;":"\u2AD8","supE;":"\u2AC6","supedot;":"\u2AC4","Superset;":"\u2283","SupersetEqual;":"\u2287","suphsol;":"\u27C9","suphsub;":"\u2AD7","suplarr;":"\u297B","supmult;":"\u2AC2","supnE;":"\u2ACC","supne;":"\u228B","supplus;":"\u2AC0","supset;":"\u2283","Supset;":"\u22D1","supseteq;":"\u2287","supseteqq;":"\u2AC6","supsetneq;":"\u228B","supsetneqq;":"\u2ACC","supsim;":"\u2AC8","supsub;":"\u2AD4","supsup;":"\u2AD6","swarhk;":"\u2926","swarr;":"\u2199","swArr;":"\u21D9","swarrow;":"\u2199","swnwar;":"\u292A","Tab;":"\u0009","target;":"\u2316","tbrk;":"\u23B4","Tcaron;":"\u0164","tcaron;":"\u0165","Tcedil;":"\u0162","tcedil;":"\u0163","Tcy;":"\u0422","tcy;":"\u0442","tdot;":"\u20DB","telrec;":"\u2315","Tfr;":"\uD835\uDD17","tfr;":"\uD835\uDD31","therefore;":"\u2234","Therefore;":"\u2234","thetav;":"\u03D1","thickapprox;":"\u2248","thicksim;":"\u223C","ThickSpace;":"\u205F\u200A","ThinSpace;":"\u2009","thkap;":"\u2248","thksim;":"\u223C","Tilde;":"\u223C","TildeEqual;":"\u2243","TildeFullEqual;":"\u2245","TildeTilde;":"\u2248","timesbar;":"\u2A31","timesb;":"\u22A0","timesd;":"\u2A30","tint;":"\u222D","toea;":"\u2928","topbot;":"\u2336","topcir;":"\u2AF1","top;":"\u22A4","Topf;":"\uD835\uDD4B","topf;":"\uD835\uDD65","topfork;":"\u2ADA","tosa;":"\u2929","tprime;":"\u2034","TRADE;":"\u2122","triangle;":"\u25B5","triangledown;":"\u25BF","triangleleft;":"\u25C3","trianglelefteq;":"\u22B4","triangleq;":"\u225C","triangleright;":"\u25B9","trianglerighteq;":"\u22B5","tridot;":"\u25EC","trie;":"\u225C","triminus;":"\u2A3A","TripleDot;":"\u20DB","triplus;":"\u2A39","trisb;":"\u29CD","tritime;":"\u2A3B","trpezium;":"\u23E2","Tscr;":"\uD835\uDCAF","tscr;":"\uD835\uDCC9","TScy;":"\u0426","tscy;":"\u0446","TSHcy;":"\u040B","tshcy;":"\u045B","Tstrok;":"\u0166","tstrok;":"\u0167","twixt;":"\u226C","twoheadleftarrow;":"\u219E","twoheadrightarrow;":"\u21A0","Uarr;":"\u219F","Uarrocir;":"\u2949","Ubrcy;":"\u040E","ubrcy;":"\u045E","Ubreve;":"\u016C","ubreve;":"\u016D","Ucy;":"\u0423","ucy;":"\u0443","udarr;":"\u21C5","Udblac;":"\u0170","udblac;":"\u0171","udhar;":"\u296E","ufisht;":"\u297E","Ufr;":"\uD835\uDD18","ufr;":"\uD835\uDD32","uHar;":"\u2963","uharl;":"\u21BF","uharr;":"\u21BE","uhblk;":"\u2580","ulcorn;":"\u231C","ulcorner;":"\u231C","ulcrop;":"\u230F","ultri;":"\u25F8","Umacr;":"\u016A","umacr;":"\u016B","UnderBar;":"\u005F","UnderBrace;":"\u23DF","UnderBracket;":"\u23B5","UnderParenthesis;":"\u23DD","Union;":"\u22C3","UnionPlus;":"\u228E","Uogon;":"\u0172","uogon;":"\u0173","Uopf;":"\uD835\uDD4C","uopf;":"\uD835\uDD66","UpArrowBar;":"\u2912","uparrow;":"\u2191","UpArrow;":"\u2191","Uparrow;":"\u21D1","UpArrowDownArrow;":"\u21C5","updownarrow;":"\u2195","UpDownArrow;":"\u2195","Updownarrow;":"\u21D5","UpEquilibrium;":"\u296E","upharpoonleft;":"\u21BF","upharpoonright;":"\u21BE","uplus;":"\u228E","UpperLeftArrow;":"\u2196","UpperRightArrow;":"\u2197","upsi;":"\u03C5","Upsi;":"\u03D2","UpTeeArrow;":"\u21A5","UpTee;":"\u22A5","upuparrows;":"\u21C8","urcorn;":"\u231D","urcorner;":"\u231D","urcrop;":"\u230E","Uring;":"\u016E","uring;":"\u016F","urtri;":"\u25F9","Uscr;":"\uD835\uDCB0","uscr;":"\uD835\uDCCA","utdot;":"\u22F0","Utilde;":"\u0168","utilde;":"\u0169","utri;":"\u25B5","utrif;":"\u25B4","uuarr;":"\u21C8","uwangle;":"\u29A7","vangrt;":"\u299C","varepsilon;":"\u03F5","varkappa;":"\u03F0","varnothing;":"\u2205","varphi;":"\u03D5","varpi;":"\u03D6","varpropto;":"\u221D","varr;":"\u2195","vArr;":"\u21D5","varrho;":"\u03F1","varsigma;":"\u03C2","varsubsetneq;":"\u228A\uFE00","varsubsetneqq;":"\u2ACB\uFE00","varsupsetneq;":"\u228B\uFE00","varsupsetneqq;":"\u2ACC\uFE00","vartheta;":"\u03D1","vartriangleleft;":"\u22B2","vartriangleright;":"\u22B3","vBar;":"\u2AE8","Vbar;":"\u2AEB","vBarv;":"\u2AE9","Vcy;":"\u0412","vcy;":"\u0432","vdash;":"\u22A2","vDash;":"\u22A8","Vdash;":"\u22A9","VDash;":"\u22AB","Vdashl;":"\u2AE6","veebar;":"\u22BB","vee;":"\u2228","Vee;":"\u22C1","veeeq;":"\u225A","vellip;":"\u22EE","verbar;":"\u007C","Verbar;":"\u2016","vert;":"\u007C","Vert;":"\u2016","VerticalBar;":"\u2223","VerticalLine;":"\u007C","VerticalSeparator;":"\u2758","VerticalTilde;":"\u2240","VeryThinSpace;":"\u200A","Vfr;":"\uD835\uDD19","vfr;":"\uD835\uDD33","vltri;":"\u22B2","vnsub;":"\u2282\u20D2","vnsup;":"\u2283\u20D2","Vopf;":"\uD835\uDD4D","vopf;":"\uD835\uDD67","vprop;":"\u221D","vrtri;":"\u22B3","Vscr;":"\uD835\uDCB1","vscr;":"\uD835\uDCCB","vsubnE;":"\u2ACB\uFE00","vsubne;":"\u228A\uFE00","vsupnE;":"\u2ACC\uFE00","vsupne;":"\u228B\uFE00","Vvdash;":"\u22AA","vzigzag;":"\u299A","Wcirc;":"\u0174","wcirc;":"\u0175","wedbar;":"\u2A5F","wedge;":"\u2227","Wedge;":"\u22C0","wedgeq;":"\u2259","Wfr;":"\uD835\uDD1A","wfr;":"\uD835\uDD34","Wopf;":"\uD835\uDD4E","wopf;":"\uD835\uDD68","wp;":"\u2118","wr;":"\u2240","wreath;":"\u2240","Wscr;":"\uD835\uDCB2","wscr;":"\uD835\uDCCC","xcap;":"\u22C2","xcirc;":"\u25EF","xcup;":"\u22C3","xdtri;":"\u25BD","Xfr;":"\uD835\uDD1B","xfr;":"\uD835\uDD35","xharr;":"\u27F7","xhArr;":"\u27FA","xlarr;":"\u27F5","xlArr;":"\u27F8","xmap;":"\u27FC","xnis;":"\u22FB","xodot;":"\u2A00","Xopf;":"\uD835\uDD4F","xopf;":"\uD835\uDD69","xoplus;":"\u2A01","xotime;":"\u2A02","xrarr;":"\u27F6","xrArr;":"\u27F9","Xscr;":"\uD835\uDCB3","xscr;":"\uD835\uDCCD","xsqcup;":"\u2A06","xuplus;":"\u2A04","xutri;":"\u25B3","xvee;":"\u22C1","xwedge;":"\u22C0","YAcy;":"\u042F","yacy;":"\u044F","Ycirc;":"\u0176","ycirc;":"\u0177","Ycy;":"\u042B","ycy;":"\u044B","Yfr;":"\uD835\uDD1C","yfr;":"\uD835\uDD36","YIcy;":"\u0407","yicy;":"\u0457","Yopf;":"\uD835\uDD50","yopf;":"\uD835\uDD6A","Yscr;":"\uD835\uDCB4","yscr;":"\uD835\uDCCE","YUcy;":"\u042E","yucy;":"\u044E","Zacute;":"\u0179","zacute;":"\u017A","Zcaron;":"\u017D","zcaron;":"\u017E","Zcy;":"\u0417","zcy;":"\u0437","Zdot;":"\u017B","zdot;":"\u017C","zeetrf;":"\u2128","ZeroWidthSpace;":"\u200B","zfr;":"\uD835\uDD37","Zfr;":"\u2128","ZHcy;":"\u0416","zhcy;":"\u0436","zigrarr;":"\u21DD","zopf;":"\uD835\uDD6B","Zopf;":"\u2124","Zscr;":"\uD835\uDCB5","zscr;":"\uD835\uDCCF"} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/xml.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/xml.json deleted file mode 100644 index b6e781c1..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/entities/xml.json +++ /dev/null @@ -1 +0,0 @@ -{"amp;":"\u0026","apos;":"\u0027","gt;":"\u003e","lt;":"\u003c","quot;":"\u0022"} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/index.js deleted file mode 100644 index b5365383..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/index.js +++ /dev/null @@ -1,117 +0,0 @@ -var modes = ["XML", "HTML4", "HTML5"]; - -module.exports = { - decode: function(data, level){ - if(!modes[level]) level = 0; - return module.exports["decode" + modes[level]](data); - }, - decodeStrict: function(data, level){ - if(!modes[level]) level = 0; - return module.exports["decode" + modes[level] + "Strict"](data); - }, - encode: function(data, level){ - if(!modes[level]) level = 0; - return module.exports["encode" + modes[level]](data); - } -}; - -modes.reduce(function(prev, name){ - var obj = require("./entities/" + name.toLowerCase() + ".json"); - - if(prev){ - Object.keys(prev).forEach(function(name){ - obj[name] = prev[name]; - }); - } - - module.exports["decode" + name + "Strict"] = getStrictReplacer(obj); - - if(name === "XML"){ - //there is no non-strict mode for XML - module.exports.decodeXML = module.exports.decodeXMLStrict; - } else { - module.exports["decode" + name] = getReplacer(obj); - } - - module.exports["encode" + name] = getReverse(obj); - - return obj; -}, null); - -function getReplacer(obj){ - var keys = Object.keys(obj).sort(); - var re = keys.join("|").replace(/(\w+)\|\1;/g, "$1;?"); - - // also match hex and char codes - re += "|#[xX][\\da-fA-F]+;?|#\\d+;?"; - - return genReplaceFunc( - new RegExp("&(?:" + re + ")", "g"), - function func(name){ - if(name.charAt(1) === "#"){ - if(name.charAt(2).toLowerCase() === "x"){ - return String.fromCharCode(parseInt(name.substr(3), 16)); - } - return String.fromCharCode(parseInt(name.substr(2), 10)); - } - return obj[name.substr(1)]; - } - ); -} - -function getStrictReplacer(obj){ - var keys = Object.keys(obj).sort().filter(RegExp.prototype.test, /;$/); - var re = keys.map(function(name){ - return name.slice(0, -1); //remove trailing semicolon - }).join("|"); - - // also match hex and char codes - re += "|#[xX][\\da-fA-F]+|#\\d+"; - - var expr = new RegExp("&(?:" + re + ");", "g"); - - return genReplaceFunc(expr, func); - - function func(name){ - if(name.charAt(1) === "#"){ - if(name.charAt(2).toLowerCase() === "x"){ - return String.fromCharCode(parseInt(name.substr(3), 16)); - } - return String.fromCharCode(parseInt(name.substr(2), 10)); - } - return obj[name.substr(1)]; - } -} - -var re_nonUTF8 = /[\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]/g; - -function nonUTF8Replacer(c){ - return "&#" + c.charCodeAt(0) + ";"; -} - -function getReverse(obj){ - var reverse = Object.keys(obj).filter(function(name){ - //prefer identifiers with a semicolon - return name.substr(-1) === ";" || obj[name + ";"] !== obj[name]; - }).reduce(function(reverse, name){ - reverse[obj[name]] = name; - return reverse; - }, {}); - - var regex = new RegExp("\\" + Object.keys(reverse).sort().join("|\\"), "g"); - function func(name){ - return "&" + reverse[name]; - } - - return function(data){ - return data - .replace(regex, func) - .replace(re_nonUTF8, nonUTF8Replacer); - }; -} - -function genReplaceFunc(regex, func){ - return function(data){ - return data.replace(regex, func); - }; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/package.json deleted file mode 100644 index de61b5a8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "entities", - "version": "0.3.0", - "description": "Encode & decode XML/HTML entities with ease", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "keywords": [ - "html", - "xml", - "entity", - "encoding" - ], - "main": "./index.js", - "directories": { - "test": "test" - }, - "devDependencies": { - "mocha": "~1.9.0" - }, - "scripts": { - "test": "mocha" - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/node-entities.git" - }, - "license": "BSD-like", - "readme": "#entities\n\nEn- & decoder for XML/HTML entities.\n\n####Features:\n* Focussed on ___speed___\n* Supports three levels of entities: __XML__, __HTML4__ & __HTML5__\n * Supports _char code_ entities (eg. `U`)\n\n##How to…\n\n###…install `entities`\n\n npm i entities\n\n###…use `entities`\n\n```javascript\n//encoding\nrequire(\"entities\").encode( data[, level]);\n//decoding\nrequire(\"entities\").decode( data[, level]);\n```\n\nThe `level` attribute indicates what level of entities should be decoded (0 = XML, 1 = HTML4 and 2 = HTML5). The default is 0 (read: XML).\n\nThere are also methods to access the level directly. Just append the name of the level to the action and you're ready to go (e.g. `encodeHTML4(data)`, `decodeXML(data)`).\n", - "readmeFilename": "readme.md", - "bugs": { - "url": "https://github.com/fb55/node-entities/issues" - }, - "homepage": "https://github.com/fb55/node-entities", - "_id": "entities@0.3.0", - "dist": { - "shasum": "3e65fd50729380e0e60367e97b05e9b64182e6a8" - }, - "_from": "entities@0.x", - "_resolved": "https://registry.npmjs.org/entities/-/entities-0.3.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/readme.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/readme.md deleted file mode 100644 index ebd87df3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/readme.md +++ /dev/null @@ -1,27 +0,0 @@ -#entities - -En- & decoder for XML/HTML entities. - -####Features: -* Focussed on ___speed___ -* Supports three levels of entities: __XML__, __HTML4__ & __HTML5__ - * Supports _char code_ entities (eg. `U`) - -##How to… - -###…install `entities` - - npm i entities - -###…use `entities` - -```javascript -//encoding -require("entities").encode( data[, level]); -//decoding -require("entities").decode( data[, level]); -``` - -The `level` attribute indicates what level of entities should be decoded (0 = XML, 1 = HTML4 and 2 = HTML5). The default is 0 (read: XML). - -There are also methods to access the level directly. Just append the name of the level to the action and you're ready to go (e.g. `encodeHTML4(data)`, `decodeXML(data)`). diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/test/mocha.opts b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/test/mocha.opts deleted file mode 100644 index af53e242..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---check-leaks ---reporter spec diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/test/test.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/test/test.js deleted file mode 100644 index fa6c00df..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/entities/test/test.js +++ /dev/null @@ -1,68 +0,0 @@ -var assert = require("assert"); -var entities = require('../'); - -describe("Encode->decode test", function() { - var testcases = [ - { - input: "asdf & ÿ ü '", - xml: "asdf & ÿ ü '", - html4: "asdf & ÿ ü '", - html5: "asdf & ÿ ü '" - }, { - input: "&", - xml: "&#38;", - html4: "&#38;", - html5: "&#38;" - }, - ]; - testcases.forEach(function(tc) { - var encodedXML = entities.encodeXML(tc.input); - it("should XML encode " + tc.input, function() { - assert.equal(encodedXML, tc.xml); - }); - it("should XML decode " + encodedXML, function() { - assert.equal(entities.decodeXML(encodedXML), tc.input); - }); - var encodedHTML4 = entities.encodeHTML4(tc.input); - it("should HTML4 encode " + tc.input, function() { - assert.equal(encodedHTML4, tc.html4); - }); - it("should HTML4 decode " + encodedHTML4, function() { - assert.equal(entities.decodeHTML4(encodedHTML4), tc.input); - }); - var encodedHTML5 = entities.encodeHTML5(tc.input); - it("should HTML5 encode " + tc.input, function() { - assert.equal(encodedHTML5, tc.html5); - }); - it("should HTML5 decode " + encodedHTML5, function() { - assert.equal(entities.decodeHTML5(encodedHTML5), tc.input); - }); - }); -}); - -describe("Decode test", function() { - var testcases = [ - { input: "&amp;", output: "&" }, - { input: "&#38;", output: "&" }, - { input: "&#x26;", output: "&" }, - { input: "&#X26;", output: "&" }, - { input: "&#38;", output: "&" }, - { input: "&#38;", output: "&" }, - { input: "&#38;", output: "&" }, - { input: ":", output: ":" }, - { input: ":", output: ":" }, - { input: ":", output: ":" }, - { input: ":", output: ":" } - ]; - testcases.forEach(function(tc) { - it("should XML decode " + tc.input, function() { - assert.equal(entities.decodeXML(tc.input), tc.output); - }); - it("should HTML4 decode " + tc.input, function() { - assert.equal(entities.decodeHTML4(tc.input), tc.output); - }); - it("should HTML5 decode " + tc.input, function() { - assert.equal(entities.decodeHTML5(tc.input), tc.output); - }); - }); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.gitattributes b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.gitattributes deleted file mode 100644 index 4bb50dc1..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text eol=lf \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.npmignore deleted file mode 100644 index 0db216bf..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -npm-debug.log -node_modules diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.travis.yml deleted file mode 100644 index d63ba095..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.10 - - 0.11 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/LICENSE deleted file mode 100644 index 0a35e029..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright 2010, 2011, Chris Winberry . All rights reserved. -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/README.md deleted file mode 100644 index 9ed236d4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/node_modules/htmlparser2/README.md +++ /dev/null @@ -1,81 +0,0 @@ -#htmlparser2 [![NPM version](https://badge.fury.io/js/htmlparser2.png)](https://npmjs.org/package/htmlparser2) [![Build Status](https://secure.travis-ci.org/fb55/htmlparser2.png)](http://travis-ci.org/fb55/htmlparser2) [![Dependency Status](https://david-dm.org/fb55/htmlparser2.png)](https://david-dm.org/fb55/htmlparser2) - -A forgiving HTML/XML/RSS parser written in JS for NodeJS. The parser can handle streams (chunked data) and supports custom handlers for writing custom DOMs/output. - -##Installing - npm install htmlparser2 - -A live demo of htmlparser2 is available at http://demos.forbeslindesay.co.uk/htmlparser2/ - -##Usage - -```javascript -var htmlparser = require("htmlparser2"); -var parser = new htmlparser.Parser({ - onopentag: function(name, attribs){ - if(name === "script" && attribs.type === "text/javascript"){ - console.log("JS! Hooray!"); - } - }, - ontext: function(text){ - console.log("-->", text); - }, - onclosetag: function(tagname){ - if(tagname === "script"){ - console.log("That's it?!"); - } - } -}); -parser.write("Xyz alert("XSS!")'); - }); - - it('(key, value) : should coerce values to a string', function() { - var $apple = $('.apple', fruits); - $apple.attr('data-test', 1); - expect($apple[0].attribs['data-test']).to.equal('1'); - expect($apple.attr('data-test')).to.equal('1'); - }); - }); - - describe('.data', function() { - - it('() : should get all data attributes', function() { - var data = $('.linth', chocolates).data(); - expect(data).to.eql({ - highlight: 'Lindor', - origin: 'swiss' - }); - }); - - it('() : no data attribute should return an empty object', function() { - var data = $('.cailler', chocolates).data(); - expect(data).to.be.empty(); - }); - - it('(invalid key) : invalid data attribute should return `undefined` ', function() { - var data = $('.frey', chocolates).data('lol'); - expect(data).to.be(undefined); - }); - - it('(valid key) : valid data attribute should get value', function() { - var highlight = $('.linth', chocolates).data('highlight'); - var origin = $('.linth', chocolates).data('origin'); - - expect(highlight).to.equal('Lindor'); - expect(origin).to.equal('swiss'); - }); - - it('(hyphen key) : data addribute with hyphen should be camelized ;-)', function() { - var data = $('.frey', chocolates).data(); - expect(data).to.eql({ - taste: 'sweet', - bestCollection: 'Mahony' - }); - }); - - it('(key, value) : should set data attribute', function() { - // Adding as object. - var a = $('.frey', chocolates).data({ - balls: 'giandor' - }); - // Adding as string. - var b = $('.linth', chocolates).data('snack', 'chocoletti'); - - expect(a.data('balls')).to.eql('giandor'); - expect(b.data('snack')).to.eql('chocoletti'); - }); - - it('(map) : object map should set multiple data attributes', function() { - var data = $('.linth', chocolates).data({ - id: 'Cailler', - flop: 'Pippilotti Rist', - top: 'Frigor', - url: 'http://www.cailler.ch/' - })['0'].data; - - expect(data.id).to.equal('Cailler'); - expect(data.flop).to.equal('Pippilotti Rist'); - expect(data.top).to.equal('Frigor'); - expect(data.url).to.equal('http://www.cailler.ch/'); - }); - - describe('(attr) : data-* attribute type coercion :', function() { - it('boolean', function() { - var $el = $('
    '); - expect($el.data('bool')).to.be(true); - }); - - it('number', function() { - var $el = $('
    '); - expect($el.data('number')).to.be(23); - }); - - it('number (scientific notation is not coerced)', function() { - var $el = $('
    '); - expect($el.data('sci')).to.be('1E10'); - }); - - it('null', function() { - var $el = $('
    '); - expect($el.data('null')).to.be(null); - }); - - it('object', function() { - var $el = $('
    '); - expect($el.data('obj')).to.eql({ a: 45 }); - }); - - it('array', function() { - var $el = $('
    '); - expect($el.data('array')).to.eql([1, 2, 3]); - }); - - }); - - }); - - - describe('.val', function() { - it('.val(): on select should get value', function() { - var val = $('select#one', inputs).val(); - expect(val).to.equal('option_selected'); - }); - it('.val(): on option should get value', function() { - var val = $('select#one option', inputs).eq(0).val(); - expect(val).to.equal('option_not_selected'); - }); - it('.val(): on text input should get value', function() { - var val = $('input[type="text"]', inputs).val(); - expect(val).to.equal('input_text'); - }); - it('.val(): on checked checkbox should get value', function() { - var val = $('input[name="checkbox_on"]', inputs).val(); - expect(val).to.equal('on'); - }); - it('.val(): on unchecked checkbox should get value', function() { - var val = $('input[name="checkbox_off"]', inputs).val(); - expect(val).to.equal('off'); - }); - it('.val(): on radio should get value', function() { - var val = $('input[type="radio"]', inputs).val(); - expect(val).to.equal('on'); - }); - it('.val(): on multiple select should get an array of values', function() { - var val = $('select#multi', inputs).val(); - expect(val).to.have.length(2); - }); - it('.val(value): on input text should set value', function() { - var element = $('input[type="text"]', inputs).val('test'); - expect(element.val()).to.equal('test'); - }); - it('.val(value): on select should set value', function() { - var element = $('select#one', inputs).val('option_not_selected'); - expect(element.val()).to.equal('option_not_selected'); - }); - it('.val(value): on option should set value', function() { - var element = $('select#one option', inputs).eq(0).val('option_changed'); - expect(element.val()).to.equal('option_changed'); - }); - it('.val(value): on radio should set value', function() { - var element = $('input[name="radio"]', inputs).val('off'); - expect(element.val()).to.equal('off'); - }); - it('.val(values): on multiple select should set multiple values', function() { - var element = $('select#multi', inputs).val(['1', '3', '4']); - expect(element.val()).to.have.length(3); - }); - }); - - describe('.removeAttr', function() { - - it('(key) : should remove a single attr', function() { - var $fruits = $(fruits); - expect($fruits.attr('id')).to.not.be(undefined); - $fruits.removeAttr('id'); - expect($fruits.attr('id')).to.be(undefined); - }); - - it('should return cheerio object', function() { - var obj = $('ul', fruits).removeAttr('id').cheerio; - expect(obj).to.be.ok(); - }); - - }); - - describe('.hasClass', function() { - - it('(valid class) : should return true', function() { - var $fruits = $(fruits); - var cls = $('.apple', $fruits).hasClass('apple'); - expect(cls).to.be.ok(); - }); - - it('(invalid class) : should return false', function() { - var cls = $('#fruits', fruits).hasClass('fruits'); - expect(cls).to.not.be.ok(); - }); - - it('should check multiple classes', function() { - var $fruits = $(fruits); - - // Add a class - $('.apple', $fruits).addClass('red'); - expect($('.apple', $fruits).hasClass('apple')).to.be.ok(); - expect($('.apple', $fruits).hasClass('red')).to.be.ok(); - - // Remove one and test again - $('.apple', $fruits).removeClass('apple'); - expect($('li', $fruits).eq(0).hasClass('apple')).to.not.be.ok(); - // expect($('li', $fruits).eq(0).hasClass('red')).to.be.ok(); - }); - }); - - describe('.addClass', function() { - - it('(first class) : should add the class to the element', function() { - var $fruits = $(fruits); - $fruits.addClass('fruits'); - var cls = $fruits.hasClass('fruits'); - expect(cls).to.be.ok(); - }); - - it('(single class) : should add the class to the element', function() { - var $fruits = $(fruits); - $('.apple', $fruits).addClass('fruit'); - var cls = $('.apple', $fruits).hasClass('fruit'); - expect(cls).to.be.ok(); - }); - - it('(class): adds classes to many selected items', function() { - var $fruits = $(fruits); - $('li', $fruits).addClass('fruit'); - expect($('.apple', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.orange', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.pear', $fruits).hasClass('fruit')).to.be.ok(); - }); - - it('(class class class) : should add multiple classes to the element', function() { - var $fruits = $(fruits); - $('.apple', $fruits).addClass('fruit red tasty'); - expect($('.apple', $fruits).hasClass('apple')).to.be.ok(); - expect($('.apple', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.apple', $fruits).hasClass('red')).to.be.ok(); - expect($('.apple', $fruits).hasClass('tasty')).to.be.ok(); - }); - - it('(fn) : should add classes returned from the function', function() { - var $fruits = $(fruits).children(); - var args = []; - var thisVals = []; - var toAdd = ['apple red', '', undefined]; - - $fruits.addClass(function(idx, currentClass) { - args.push(arguments); - thisVals.push(this); - return toAdd[idx]; - }); - - expect(args).to.eql([ - [0, 'apple'], - [1, 'orange'], - [2, 'pear'] - ]); - expect(thisVals).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - expect($fruits.eq(0).hasClass('apple')).to.be.ok(); - expect($fruits.eq(0).hasClass('red')).to.be.ok(); - expect($fruits.eq(1).hasClass('orange')).to.be.ok(); - expect($fruits.eq(2).hasClass('pear')).to.be.ok(); - }); - - }); - - describe('.removeClass', function() { - - it('() : should remove all the classes', function() { - var $fruits = $(fruits); - $('.pear', $fruits).addClass('fruit'); - $('.pear', $fruits).removeClass(); - expect($('.pear', $fruits).attr('class')).to.be(undefined); - }); - - it('("") : should not modify class list', function() { - var $fruits = $(fruits); - $fruits.children().removeClass(''); - expect($('.apple', $fruits)).to.have.length(1); - }); - - it('(invalid class) : should not remove anything', function() { - var $fruits = $(fruits); - $('.pear', $fruits).removeClass('fruit'); - expect($('.pear', $fruits).hasClass('pear')).to.be.ok(); - }); - - it('(no class attribute) : should not throw an exception', function() { - var $vegetables = $(vegetables); - var thrown = null; - expect(function() { - $('li', $vegetables).removeClass('vegetable'); - }) - .to.not.throwException(); - }); - - it('(single class) : should remove a single class from the element', function() { - var $fruits = $(fruits); - $('.pear', $fruits).addClass('fruit'); - expect($('.pear', $fruits).hasClass('fruit')).to.be.ok(); - $('.pear', $fruits).removeClass('fruit'); - expect($('.pear', $fruits).hasClass('fruit')).to.not.be.ok(); - expect($('.pear', $fruits).hasClass('pear')).to.be.ok(); - }); - - it('(single class) : should remove a single class from multiple classes on the element', function() { - var $fruits = $(fruits); - $('.pear', $fruits).addClass('fruit green tasty'); - expect($('.pear', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.pear', $fruits).hasClass('green')).to.be.ok(); - expect($('.pear', $fruits).hasClass('tasty')).to.be.ok(); - - $('.pear', $fruits).removeClass('green'); - expect($('.pear', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.pear', $fruits).hasClass('green')).to.not.be.ok(); - expect($('.pear', $fruits).hasClass('tasty')).to.be.ok(); - }); - - it('(class class class) : should remove multiple classes from the element', function() { - var $fruits = $(fruits); - - $('.apple', $fruits).addClass('fruit red tasty'); - expect($('.apple', $fruits).hasClass('apple')).to.be.ok(); - expect($('.apple', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.apple', $fruits).hasClass('red')).to.be.ok(); - expect($('.apple', $fruits).hasClass('tasty')).to.be.ok(); - - $('.apple', $fruits).removeClass('apple red tasty'); - expect($('.fruit', $fruits).hasClass('apple')).to.not.be.ok(); - expect($('.fruit', $fruits).hasClass('red')).to.not.be.ok(); - expect($('.fruit', $fruits).hasClass('tasty')).to.not.be.ok(); - expect($('.fruit', $fruits).hasClass('fruit')).to.be.ok(); - }); - - it('(class) : should remove all occurrences of a class name', function() { - var $div = $('
    '); - expect($div.removeClass('x').hasClass('x')).to.be(false); - }); - - it('(fn) : should remove classes returned from the function', function() { - var $fruits = $(fruits).children(); - var args = []; - var thisVals = []; - var toAdd = ['apple red', '', undefined]; - - $fruits.removeClass(function(idx, currentClass) { - args.push(arguments); - thisVals.push(this); - return toAdd[idx]; - }); - - expect(args).to.eql([ - [0, 'apple'], - [1, 'orange'], - [2, 'pear'] - ]); - expect(thisVals).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - expect($fruits.eq(0).hasClass('apple')).to.not.be.ok(); - expect($fruits.eq(0).hasClass('red')).to.not.be.ok(); - expect($fruits.eq(1).hasClass('orange')).to.be.ok(); - expect($fruits.eq(2).hasClass('pear')).to.be.ok(); - }); - - }); - - describe('.toggleClass', function() { - - it('(class class) : should toggle multiple classes from the element', function() { - var $fruits = $(fruits); - - $('.apple', $fruits).addClass('fruit'); - expect($('.apple', $fruits).hasClass('apple')).to.be.ok(); - expect($('.apple', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.apple', $fruits).hasClass('red')).to.not.be.ok(); - - $('.apple', $fruits).toggleClass('apple red'); - expect($('.fruit', $fruits).hasClass('apple')).to.not.be.ok(); - expect($('.fruit', $fruits).hasClass('red')).to.be.ok(); - expect($('.fruit', $fruits).hasClass('fruit')).to.be.ok(); - }); - - it('(class class, true) : should add multiple classes to the element', function() { - var $fruits = $(fruits); - - $('.apple', $fruits).addClass('fruit'); - expect($('.apple', $fruits).hasClass('apple')).to.be.ok(); - expect($('.apple', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.apple', $fruits).hasClass('red')).to.not.be.ok(); - - $('.apple', $fruits).toggleClass('apple red', true); - expect($('.fruit', $fruits).hasClass('apple')).to.be.ok(); - expect($('.fruit', $fruits).hasClass('red')).to.be.ok(); - expect($('.fruit', $fruits).hasClass('fruit')).to.be.ok(); - }); - - it('(class class, false) : should remove multiple classes from the element', function() { - var $fruits = $(fruits); - - $('.apple', $fruits).addClass('fruit'); - expect($('.apple', $fruits).hasClass('apple')).to.be.ok(); - expect($('.apple', $fruits).hasClass('fruit')).to.be.ok(); - expect($('.apple', $fruits).hasClass('red')).to.not.be.ok(); - - $('.apple', $fruits).toggleClass('apple red', false); - expect($('.fruit', $fruits).hasClass('apple')).to.not.be.ok(); - expect($('.fruit', $fruits).hasClass('red')).to.not.be.ok(); - expect($('.fruit', $fruits).hasClass('fruit')).to.be.ok(); - }); - - it('(fn) : should toggle classes returned from the function', function() { - var $food = $(food); - - $('.apple', $food).addClass('fruit'); - $('.carrot', $food).addClass('vegetable'); - expect($('.apple', $food).hasClass('fruit')).to.be.ok(); - expect($('.apple', $food).hasClass('vegetable')).to.not.be.ok(); - expect($('.orange', $food).hasClass('fruit')).to.not.be.ok(); - expect($('.orange', $food).hasClass('vegetable')).to.not.be.ok(); - expect($('.carrot', $food).hasClass('fruit')).to.not.be.ok(); - expect($('.carrot', $food).hasClass('vegetable')).to.be.ok(); - expect($('.sweetcorn', $food).hasClass('fruit')).to.not.be.ok(); - expect($('.sweetcorn', $food).hasClass('vegetable')).to.not.be.ok(); - - $('li', $food).toggleClass(function(index, className, switchVal) { - return $(this).parent().is('#fruits') ? 'fruit' : 'vegetable'; - }); - expect($('.apple', $food).hasClass('fruit')).to.not.be.ok(); - expect($('.apple', $food).hasClass('vegetable')).to.not.be.ok(); - expect($('.orange', $food).hasClass('fruit')).to.be.ok(); - expect($('.orange', $food).hasClass('vegetable')).to.not.be.ok(); - expect($('.carrot', $food).hasClass('fruit')).to.not.be.ok(); - expect($('.carrot', $food).hasClass('vegetable')).to.not.be.ok(); - expect($('.sweetcorn', $food).hasClass('fruit')).to.not.be.ok(); - expect($('.sweetcorn', $food).hasClass('vegetable')).to.be.ok(); - }); - - }); - - describe('.is', function () { - it('() : should return false', function() { - expect($('li.apple', fruits).is()).to.be(false); - }); - - it('(true selector) : should return true', function() { - expect($('#vegetables', vegetables).is('ul')).to.be(true); - }); - - it('(false selector) : should return false', function() { - expect($('#vegetables', vegetables).is('div')).to.be(false); - }); - - it('(true selection) : should return true', function() { - var $vegetables = $('li', vegetables); - expect($vegetables.is($vegetables.eq(1))).to.be(true); - }); - - it('(false selection) : should return false', function() { - var $vegetableList = $(vegetables); - var $vegetables = $vegetableList.find('li'); - expect($vegetables.is($vegetableList)).to.be(false); - }); - - it('(true element) : should return true', function() { - var $vegetables = $('li', vegetables); - expect($vegetables.is($vegetables[0])).to.be(true); - }); - - it('(false element) : should return false', function() { - var $vegetableList = $(vegetables); - var $vegetables = $vegetableList.find('li'); - expect($vegetables.is($vegetableList[0])).to.be(false); - }); - - it('(true predicate) : should return true', function() { - var result = $('li', fruits).is(function() { - return this.hasClass('pear'); - }); - expect(result).to.be(true); - }); - - it('(false predicate) : should return false', function () { - var result = $('li', fruits).last().is(function() { - return this.name === 'ul'; - }); - expect(result).to.be(false); - }); - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.css.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.css.js deleted file mode 100644 index 12f4415e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.css.js +++ /dev/null @@ -1,88 +0,0 @@ -var expect = require('expect.js'); -var $ = require('..'); - -describe('$(...)', function() { - - describe('.css', function() { - it('(prop): should return a css property value', function() { - var el = $('
  • '); - expect(el.css('hai')).to.equal('there'); - }); - - it('([prop1, prop2]): should return the specified property values as an object', function() { - var el = $('
  • '); - expect(el.css(['margin', 'color'])).to.eql({ margin: '1px', color: 'blue' }); - }); - - it('(prop, val): should set a css property', function() { - var el = $('
  • '); - el.css('color', 'red'); - expect(el.attr('style')).to.equal('margin: 0; color: red;'); - expect(el.eq(1).attr('style')).to.equal('color: red;'); - }); - - it('(prop, ""): should unset a css property', function() { - var el = $('
  • '); - el.css('padding', ''); - expect(el.attr('style')).to.equal('margin: 0;'); - }); - - it('(prop): should not mangle embedded urls', function() { - var el = $('
  • '); - expect(el.css('background-image')).to.equal('url(http://example.com/img.png)'); - }); - - it('(prop): should ignore blank properties', function() { - var el = $('
  • '); - expect(el.css()).to.eql({color:'#aaa'}); - }); - - it('(prop): should ignore blank values', function() { - var el = $('
  • '); - expect(el.css()).to.eql({position:'absolute'}); - }); - - describe('(prop, function):', function() { - beforeEach(function() { - this.$el = $('
    '); - }); - - it('should iterate over the selection', function() { - var count = 0; - var $el = this.$el; - this.$el.css('margin', function(idx, elem) { - expect(idx).to.equal(count); - expect(elem).to.equal($el[count]); - expect(this).to.equal($el[count]); - count++; - }); - expect(count).to.equal(3); - }); - - it('should set each attribute independently', function() { - var values = ['4px', '', undefined]; - this.$el.css('margin', function(idx) { - return values[idx]; - }); - expect(this.$el.eq(0).attr('style')).to.equal('margin: 4px;'); - expect(this.$el.eq(1).attr('style')).to.equal(''); - expect(this.$el.eq(2).attr('style')).to.equal('margin: 0;'); - }); - }); - - it('(obj): should set each key and val', function() { - var el = $('
  • '); - el.css({ foo: 0 }); - expect(el.eq(0).attr('style')).to.equal('padding: 0; foo: 0;'); - expect(el.eq(1).attr('style')).to.equal('foo: 0;'); - }); - - describe('parser', function(){ - it('should allow any whitespace between declarations', function() { - var el = $('
  • '); - expect(el.css(['one', 'two'])).to.eql({ one: 0, two: 1 }); - }); - }); - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.manipulation.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.manipulation.js deleted file mode 100644 index 2b618387..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.manipulation.js +++ /dev/null @@ -1,716 +0,0 @@ -var expect = require('expect.js'), - $ = require('../'), - fruits = require('./fixtures').fruits; - -describe('$(...)', function() { - - describe('.append', function() { - - it('() : should do nothing', function() { - expect($('#fruits', fruits).append()[0].name).to.equal('ul'); - }); - - it('(html) : should add element as last child', function() { - var $fruits = $(fruits); - $fruits.append('
  • Plum
  • '); - expect($fruits.children(3).hasClass('plum')).to.be.ok(); - }); - - it('($(...)) : should add element as last child', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - $fruits.append($plum); - expect($fruits.children(3).hasClass('plum')).to.be.ok(); - }); - - it('(Node) : should add element as last child', function() { - var $fruits = $(fruits); - var plum = $('
  • Plum
  • ')[0]; - $fruits.append(plum); - expect($fruits.children(3).hasClass('plum')).to.be.ok(); - }); - - it('($(...), html) : should add multiple elements as last children', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - var grape = '
  • Grape
  • '; - $fruits.append($plum, grape); - expect($fruits.children(3).hasClass('plum')).to.be.ok(); - expect($fruits.children(4).hasClass('grape')).to.be.ok(); - }); - - it('(Array) : should append all elements in the array', function() { - var $fruits = $(fruits); - var more = $('
  • Plum
  • Grape
  • ') - .toArray(); - $fruits.append(more); - expect($fruits.children(3).hasClass('plum')).to.be.ok(); - expect($fruits.children(4).hasClass('grape')).to.be.ok(); - }); - - it('(fn) : should invoke the callback with the correct argument and context', function() { - var $fruits = $(fruits).children(); - var args = []; - var thisValues = []; - - $fruits.append(function() { - args.push(arguments); - thisValues.push(this); - }); - - expect(args).to.eql([ - [0, 'Apple'], - [1, 'Orange'], - [2, 'Pear'] - ]); - expect(thisValues).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - }); - - it('(fn) : should add returned string as last child', function() { - var $fruits = $(fruits).children(); - var $apple, $orange, $pear; - - $fruits.append(function() { - return '
    '; - }); - - $apple = $fruits.eq(0); - $orange = $fruits.eq(1); - $pear = $fruits.eq(2); - - expect($apple.find('.first')[0]).to.equal($apple.contents()[1]); - expect($orange.find('.first')[0]).to.equal($orange.contents()[1]); - expect($pear.find('.first')[0]).to.equal($pear.contents()[1]); - }); - - it('(fn) : should add returned Cheerio object as last child', function() { - var $fruits = $(fruits).children(); - var $apple, $orange, $pear; - - $fruits.append(function() { - return $('
    '); - }); - - $apple = $fruits.eq(0); - $orange = $fruits.eq(1); - $pear = $fruits.eq(2); - - expect($apple.find('.second')[0]).to.equal($apple.contents()[1]); - expect($orange.find('.second')[0]).to.equal($orange.contents()[1]); - expect($pear.find('.second')[0]).to.equal($pear.contents()[1]); - }); - - it('(fn) : should add returned Node as last child', function() { - var $fruits = $(fruits).children(); - var $apple, $orange, $pear; - - $fruits.append(function() { - return $('
    ')[0]; - }); - - $apple = $fruits.eq(0); - $orange = $fruits.eq(1); - $pear = $fruits.eq(2); - - expect($apple.find('.third')[0]).to.equal($apple.contents()[1]); - expect($orange.find('.third')[0]).to.equal($orange.contents()[1]); - expect($pear.find('.third')[0]).to.equal($pear.contents()[1]); - }); - - it('should maintain correct object state (Issue: #10)', function() { - var $obj = $('
    ') - .append('
    ') - .children() - .children() - .parent(); - expect($obj).to.be.ok(); - }); - - }); - - describe('.prepend', function() { - - it('() : should do nothing', function() { - expect($('#fruits', fruits).prepend()[0].name).to.equal('ul'); - }); - - it('(html) : should add element as first child', function() { - var $fruits = $(fruits); - $fruits.prepend('
  • Plum
  • '); - expect($fruits.children(0).hasClass('plum')).to.be.ok(); - }); - - it('($(...)) : should add element as first child', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - $fruits.prepend($plum); - expect($fruits.children(0).hasClass('plum')).to.be.ok(); - }); - - it('(Node) : should add node as first child', function() { - var $fruits = $(fruits); - var plum = $('
  • Plum
  • ')[0]; - $fruits.prepend(plum); - expect($fruits.children(0).hasClass('plum')).to.be.ok(); - }); - - it('(Array) : should add all elements in the array as inital children', function() { - var $fruits = $(fruits); - var more = $('
  • Plum
  • Grape
  • ') - .toArray(); - $fruits.prepend(more); - expect($fruits.children(0).hasClass('plum')).to.be.ok(); - expect($fruits.children(1).hasClass('grape')).to.be.ok(); - }); - - it('(html, $(...), html) : should add multiple elements as first children', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - var grape = '
  • Grape
  • '; - $fruits.prepend($plum, grape); - expect($fruits.children(0).hasClass('plum')).to.be.ok(); - expect($fruits.children(1).hasClass('grape')).to.be.ok(); - }); - - it('(fn) : should invoke the callback with the correct argument and context', function() { - var $fruits = $(fruits).children(); - var args = []; - var thisValues = []; - - $fruits.prepend(function() { - args.push(arguments); - thisValues.push(this); - }); - - expect(args).to.eql([ - [0, 'Apple'], - [1, 'Orange'], - [2, 'Pear'] - ]); - expect(thisValues).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - }); - - it('(fn) : should add returned string as first child', function() { - var $fruits = $(fruits).children(); - var $apple, $orange, $pear; - - $fruits.prepend(function() { - return '
    '; - }); - - $apple = $fruits.eq(0); - $orange = $fruits.eq(1); - $pear = $fruits.eq(2); - - expect($apple.find('.first')[0]).to.equal($apple.contents()[0]); - expect($orange.find('.first')[0]).to.equal($orange.contents()[0]); - expect($pear.find('.first')[0]).to.equal($pear.contents()[0]); - }); - - it('(fn) : should add returned Cheerio object as first child', function() { - var $fruits = $(fruits).children(); - var $apple, $orange, $pear; - - $fruits.prepend(function() { - return $('
    '); - }); - - $apple = $fruits.eq(0); - $orange = $fruits.eq(1); - $pear = $fruits.eq(2); - - expect($apple.find('.second')[0]).to.equal($apple.contents()[0]); - expect($orange.find('.second')[0]).to.equal($orange.contents()[0]); - expect($pear.find('.second')[0]).to.equal($pear.contents()[0]); - }); - - it('(fn) : should add returned Node as first child', function() { - var $fruits = $(fruits).children(); - var $apple, $orange, $pear; - - $fruits.prepend(function() { - return $('
    ')[0]; - }); - - $apple = $fruits.eq(0); - $orange = $fruits.eq(1); - $pear = $fruits.eq(2); - - expect($apple.find('.third')[0]).to.equal($apple.contents()[0]); - expect($orange.find('.third')[0]).to.equal($orange.contents()[0]); - expect($pear.find('.third')[0]).to.equal($pear.contents()[0]); - }); - - }); - - describe('.after', function() { - - it('() : should do nothing', function() { - expect($('#fruits', fruits).after()[0].name).to.equal('ul'); - }); - - it('(html) : should add element as next sibling', function() { - var $fruits = $(fruits); - var grape = '
  • Grape
  • '; - $('.apple', $fruits).after(grape); - expect($('.apple', $fruits).next().hasClass('grape')).to.be.ok(); - }); - - it('(Array) : should add all elements in the array as next sibling', function() { - var $fruits = $(fruits); - var more = $('
  • Plum
  • Grape
  • ') - .toArray(); - $('.apple', $fruits).after(more); - expect($fruits.children(1).hasClass('plum')).to.be.ok(); - expect($fruits.children(2).hasClass('grape')).to.be.ok(); - }); - - it('($(...)) : should add element as next sibling', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - $('.apple', $fruits).after($plum); - expect($('.apple', $fruits).next().hasClass('plum')).to.be.ok(); - }); - - it('(Node) : should add element as next sibling', function() { - var $fruits = $(fruits); - var plum = $('
  • Plum
  • ')[0]; - $('.apple', $fruits).after(plum); - expect($('.apple', $fruits).next().hasClass('plum')).to.be.ok(); - }); - - it('($(...), html) : should add multiple elements as next siblings', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - var grape = '
  • Grape
  • '; - $('.apple', $fruits).after($plum, grape); - expect($('.apple', $fruits).next().hasClass('plum')).to.be.ok(); - expect($('.plum', $fruits).next().hasClass('grape')).to.be.ok(); - }); - - it('(fn) : should invoke the callback with the correct argument and context', function() { - var $fruits = $(fruits).children(); - var args = []; - var thisValues = []; - - $fruits.after(function() { - args.push(arguments); - thisValues.push(this); - }); - - expect(args).to.eql([[0], [1], [2]]); - expect(thisValues).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - }); - - it('(fn) : should add returned string as next sibling', function() { - var $list = $(fruits); - var $fruits = $list.children(); - - $fruits.after(function() { - return '
  • '; - }); - - expect($list.find('.first')[0]).to.equal($list.contents()[1]); - expect($list.find('.first')[1]).to.equal($list.contents()[3]); - expect($list.find('.first')[2]).to.equal($list.contents()[5]); - }); - - it('(fn) : should add returned Cheerio object as next sibling', function() { - var $list = $(fruits); - var $fruits = $list.children(); - - $fruits.after(function() { - return $('
  • '); - }); - - expect($list.find('.second')[0]).to.equal($list.contents()[1]); - expect($list.find('.second')[1]).to.equal($list.contents()[3]); - expect($list.find('.second')[2]).to.equal($list.contents()[5]); - }); - - it('(fn) : should add returned element as next sibling', function() { - var $list = $(fruits); - var $fruits = $list.children(); - - $fruits.after(function() { - return $('
  • ')[0]; - }); - - expect($list.find('.third')[0]).to.equal($list.contents()[1]); - expect($list.find('.third')[1]).to.equal($list.contents()[3]); - expect($list.find('.third')[2]).to.equal($list.contents()[5]); - }); - - }); - - describe('.before', function() { - - it('() : should do nothing', function() { - expect($('#fruits', fruits).before()[0].name).to.equal('ul'); - }); - - it('(html) : should add element as previous sibling', function() { - var $fruits = $(fruits); - var grape = '
  • Grape
  • '; - $('.apple', $fruits).before(grape); - expect($('.apple', $fruits).prev().hasClass('grape')).to.be.ok(); - }); - - it('($(...)) : should add element as previous sibling', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - $('.apple', $fruits).before($plum); - expect($('.apple', $fruits).prev().hasClass('plum')).to.be.ok(); - }); - - it('(Node) : should add element as previous sibling', function() { - var $fruits = $(fruits); - var plum = $('
  • Plum
  • '); - $('.apple', $fruits).before(plum); - expect($('.apple', $fruits).prev().hasClass('plum')).to.be.ok(); - }); - - it('(Array) : should add all elements in the array as previous sibling', function() { - var $fruits = $(fruits); - var more = $('
  • Plum
  • Grape
  • ') - .toArray(); - $('.apple', $fruits).before(more); - expect($fruits.children(0).hasClass('plum')).to.be.ok(); - expect($fruits.children(1).hasClass('grape')).to.be.ok(); - }); - - it('($(...), html) : should add multiple elements as previous siblings', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - var grape = '
  • Grape
  • '; - $('.apple', $fruits).before($plum, grape); - expect($('.apple', $fruits).prev().hasClass('grape')).to.be.ok(); - expect($('.grape', $fruits).prev().hasClass('plum')).to.be.ok(); - }); - - it('(fn) : should invoke the callback with the correct argument and context', function() { - var $fruits = $(fruits).children(); - var args = []; - var thisValues = []; - - $fruits.before(function() { - args.push(arguments); - thisValues.push(this); - }); - - expect(args).to.eql([[0], [1], [2]]); - expect(thisValues).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - }); - - it('(fn) : should add returned string as previous sibling', function() { - var $list = $(fruits); - var $fruits = $list.children(); - - $fruits.before(function() { - return '
  • '; - }); - - expect($list.find('.first')[0]).to.equal($list.contents()[0]); - expect($list.find('.first')[1]).to.equal($list.contents()[2]); - expect($list.find('.first')[2]).to.equal($list.contents()[4]); - }); - - it('(fn) : should add returned Cheerio object as previous sibling', function() { - var $list = $(fruits); - var $fruits = $list.children(); - - $fruits.before(function() { - return $('
  • '); - }); - - expect($list.find('.second')[0]).to.equal($list.contents()[0]); - expect($list.find('.second')[1]).to.equal($list.contents()[2]); - expect($list.find('.second')[2]).to.equal($list.contents()[4]); - }); - - it('(fn) : should add returned Node as previous sibling', function() { - var $list = $(fruits); - var $fruits = $list.children(); - - $fruits.before(function() { - return $('
  • ')[0]; - }); - - expect($list.find('.third')[0]).to.equal($list.contents()[0]); - expect($list.find('.third')[1]).to.equal($list.contents()[2]); - expect($list.find('.third')[2]).to.equal($list.contents()[4]); - }); - - }); - - describe('.remove', function() { - - it('() : should remove selected elements', function() { - var $fruits = $(fruits); - $('.apple', $fruits).remove(); - expect($fruits.find('.apple')).to.have.length(0); - }); - - it('(selector) : should remove matching selected elements', function() { - var $fruits = $(fruits); - $('li', $fruits).remove('.apple'); - expect($fruits.find('.apple')).to.have.length(0); - }); - - }); - - describe('.replaceWith', function() { - - it('(elem) : should replace one
  • tag with another', function() { - var $fruits = $(fruits); - var $plum = $('
  • Plum
  • '); - $('.pear', $fruits).replaceWith($plum); - expect($('.orange', $fruits).next().hasClass('plum')).to.be.ok(); - expect($('.orange', $fruits).next().html()).to.equal('Plum'); - }); - - it('(Array) : should replace one
  • tag with the elements in the array', function() { - var $fruits = $(fruits); - var more = $('
  • Plum
  • Grape
  • ') - .toArray(); - $('.pear', $fruits).replaceWith(more); - - expect($fruits.children(2).hasClass('plum')).to.be.ok(); - expect($fruits.children(3).hasClass('grape')).to.be.ok(); - expect($fruits.children()).to.have.length(4); - }); - - it('(Node) : should replace the selected element with given node', function() { - var $src = $('

    hi there

    '); - var $new = $('
      '); - var $replaced = $src.find('span').replaceWith($new[0]); - expect($new[0].parent).to.equal($src[0]); - expect($replaced[0].parent).to.equal(null); - expect($.html($src)).to.equal('

      hi

        '); - }); - - it('(existing element) : should remove element from its previous location', function() { - var $fruits = $(fruits); - $('.pear', $fruits).replaceWith($('.apple', $fruits)); - expect($fruits.children()).to.have.length(2); - expect($fruits.children()[0]).to.equal($('.orange', $fruits)[0]); - expect($fruits.children()[1]).to.equal($('.apple', $fruits)[0]); - }); - - it('(elem) : should replace the single selected element with given element', function() { - var $src = $('

        hi there

        '); - var $new = $('
        here
        '); - var $replaced = $src.find('span').replaceWith($new); - expect($new[0].parent).to.equal($src[0]); - expect($replaced[0].parent).to.equal(null); - expect($.html($src)).to.equal('

        hi
        here

        '); - }); - - it('(str) : should accept strings', function() { - var $src = $('

        hi there

        '); - var newStr = '
        here
        '; - var $replaced = $src.find('span').replaceWith(newStr); - expect($replaced[0].parent).to.equal(null); - expect($.html($src)).to.equal('

        hi
        here

        '); - }); - - it('(fn) : should invoke the callback with the correct argument and context', function() { - var $fruits = $(fruits); - var origChildren = $fruits.children().toArray(); - var args = []; - var thisValues = []; - - $fruits.children().replaceWith(function() { - args.push(arguments); - thisValues.push(this); - return '
      • '; - }); - - expect(args).to.eql([[0], [1], [2]]); - expect(thisValues).to.eql([ - origChildren[0], - origChildren[1], - origChildren[2] - ]); - }); - - it('(fn) : should replace the selected element with the returned string', function() { - var $fruits = $(fruits); - - $fruits.children().replaceWith(function() { - return '
      • '; - }); - - expect($fruits.find('.first')).to.have.length(3); - }); - - it('(fn) : should replace the selected element with the returned Cheerio object', function() { - var $fruits = $(fruits); - - $fruits.children().replaceWith(function() { - return $('
      • '); - }); - - expect($fruits.find('.second')).to.have.length(3); - }); - - it('(fn) : should replace the selected element with the returned node', function() { - var $fruits = $(fruits); - - $fruits.children().replaceWith(function() { - return $('
      • ')[0]; - }); - - expect($fruits.find('.third')).to.have.length(3); - }); - - }); - - describe('.empty', function() { - - it('() : should remove all children from selected elements', function() { - var $fruits = $(fruits); - $('#fruits', $fruits).empty(); - expect($('#fruits', $fruits).children()).to.have.length(0); - }); - - }); - - describe('.html', function() { - - it('() : should get the innerHTML for an element', function() { - var $fruits = $(fruits); - expect($fruits.html()).to.equal([ - '
      • Apple
      • ', - '
      • Orange
      • ', - '
      • Pear
      • ' - ].join('')); - }); - - it('() : should get innerHTML even if its just text', function() { - var item = '
      • Pear
      • '; - expect($('.pear', item).html()).to.equal('Pear'); - }); - - it('() : should return empty string if nothing inside', function() { - var item = '
      • '; - expect($('li', item).html()).to.equal(''); - }); - - it('(html) : should set the html for its children', function() { - var $fruits = $(fruits); - $fruits.html('
      • Durian
      • '); - var html = $fruits.html(); - expect(html).to.equal('
      • Durian
      • '); - }); - - it('(elem) : should set the html for its children with element', function() { - var $fruits = $(fruits); - $fruits.html($('
      • Durian
      • ')); - var html = $fruits.html(); - expect(html).to.equal('
      • Durian
      • '); - }); - - }); - - describe('.toString', function() { - it('() : should get the outerHTML for an element', function() { - var $fruits = $(fruits); - expect($fruits.toString()).to.equal(fruits); - }); - - it('() : should return an html string for a set of elements', function() { - var $fruits = $(fruits); - expect($fruits.find('li').toString()).to.equal('
      • Apple
      • Orange
      • Pear
      • '); - }); - - it('() : should be called implicitly', function() { - var string = [$(''), $(''), $('')].join(''); - expect(string).to.equal(''); - }); - }); - - describe('.text', function() { - - it('() : gets the text for a single element', function() { - expect($('.apple', fruits).text()).to.equal('Apple'); - }); - - it('() : combines all text from children text nodes', function() { - expect($('#fruits', fruits).text()).to.equal('AppleOrangePear'); - }); - - it('(text) : sets the text for the child node', function() { - var $fruits = $(fruits); - $('.apple', $fruits).text('Granny Smith Apple'); - expect($('.apple', $fruits)[0].children[0].data).to.equal('Granny Smith Apple'); - }); - - it('should allow functions as arguments', function() { - var $fruits = $(fruits); - $('.apple', $fruits).text(function(idx, content) { - expect(idx).to.equal(0); - expect(content).to.equal('Apple'); - return 'whatever mate'; - }); - expect($('.apple', $fruits)[0].children[0].data).to.equal('whatever mate'); - }); - - it('should decode special chars', function() { - var text = $('

        M&M

        ').text(); - expect(text).to.equal('M&M'); - }); - - it('should work with special chars added as strings', function() { - var text = $('

        M&M

        ').text(); - expect(text).to.equal('M&M'); - }); - - it('( undefined ) : should act as an accessor', function() { - var $div = $('
        test
        '); - expect($div.text(undefined)).to.be.a('string'); - expect($div.text()).to.be('test'); - }); - - it('( "" ) : should convert to string', function() { - var $div = $('
        test
        '); - expect($div.text('').text()).to.equal(''); - }); - - it('( null ) : should convert to string', function() { - expect($('
        ').text(null).text()).to.equal('null'); - }); - - it('( 0 ) : should convert to string', function() { - expect($('
        ').text(0).text()).to.equal('0'); - }); - - it('(str) should encode then decode unsafe characters', function() { - var $apple = $('.apple', fruits); - - $apple.text('blah blah'); - expect($apple[0].children[0].data).to.equal('blah <script>alert("XSS!")</script> blah'); - expect($apple.text()).to.equal('blah blah'); - - $apple.text('blah blah'); - expect($apple.html()).to.not.contain(''); - }); - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.traversing.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.traversing.js deleted file mode 100644 index a67614d3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.traversing.js +++ /dev/null @@ -1,740 +0,0 @@ -var expect = require('expect.js'), - $ = require('../'), - food = require('./fixtures').food, - fruits = require('./fixtures').fruits, - drinks = require('./fixtures').drinks, - text = require('./fixtures').text; - -describe('$(...)', function() { - - describe('.find', function() { - - it('() : should find nothing', function() { - expect($('ul', fruits).find()).to.have.length(0); - }); - - it('(single) : should find one descendant', function() { - expect($('#fruits', fruits).find('.apple')[0].attribs['class']).to.equal('apple'); - }); - - it('(many) : should find all matching descendant', function() { - expect($('#fruits', fruits).find('li')).to.have.length(3); - }); - - it('(many) : should merge all selected elems with matching descendants', function() { - expect($('#fruits, #food', food).find('.apple')).to.have.length(1); - }); - - it('(invalid single) : should return empty if cant find', function() { - expect($('ul', fruits).find('blah')).to.have.length(0); - }); - - it('(invalid single) : should query descendants only', function() { - expect($('#fruits', fruits).find('ul')).to.have.length(0); - }); - - it('should return empty if search already empty result', function() { - expect($('#fruits').find('li')).to.have.length(0); - }); - - it('should throw a SyntaxError if given an invalid selector', function() { - expect(function() { - $('#fruits').find(':bah'); - }).to.throwException(function(err) { - expect(err).to.be.a(SyntaxError); - }); - }); - - }); - - describe('.children', function() { - - it('() : should get all children', function() { - expect($('ul', fruits).children()).to.have.length(3); - }); - - it('() : should return children of all matched elements', function() { - expect($('ul ul', food).children()).to.have.length(5); - }); - - it('(selector) : should return children matching selector', function() { - var cls = $('ul', fruits).children('.orange')[0].attribs['class']; - expect(cls).to.equal('orange'); - }); - - it('(invalid selector) : should return empty', function() { - expect($('ul', fruits).children('.lulz')).to.have.length(0); - }); - - it('should only match immediate children, not ancestors', function() { - expect($(food).children('li')).to.have.length(0); - }); - - }); - - describe('.contents', function() { - - it('() : should get all contents', function() { - expect($('p', text).contents()).to.have.length(5); - }); - - it('() : should include text nodes', function() { - expect($('p', text).contents().first()[0].type).to.equal('text'); - }); - - it('() : should include comment nodes', function() { - expect($('p', text).contents().last()[0].type).to.equal('comment'); - }); - - }); - - describe('.next', function() { - - it('() : should return next element', function() { - var cls = $('.orange', fruits).next()[0].attribs['class']; - expect(cls).to.equal('pear'); - }); - - it('(no next) : should return empty for last child', function() { - expect($('.pear', fruits).next()).to.have.length(0); - }); - - it('(next on empty object) : should return empty', function() { - expect($('.banana', fruits).next()).to.have.length(0); - }); - - it('() : should operate over all elements in the selection', function() { - expect($('.apple, .orange', food).next()).to.have.length(2); - }); - - }); - - describe('.nextAll', function() { - - it('() : should return all following siblings', function() { - var elems = $('.apple', fruits).nextAll(); - expect(elems).to.have.length(2); - expect(elems[0].attribs['class']).to.equal('orange'); - expect(elems[1].attribs['class']).to.equal('pear'); - }); - - it('(no next) : should return empty for last child', function() { - expect($('.pear', fruits).nextAll()).to.have.length(0); - }); - - it('(nextAll on empty object) : should return empty', function() { - expect($('.banana', fruits).nextAll()).to.have.length(0); - }); - - it('() : should operate over all elements in the selection', function() { - expect($('.apple, .carrot', food).nextAll()).to.have.length(3); - }); - - it('() : should not contain duplicate elements', function() { - var elems = $('.apple, .orange', food); - expect(elems.nextAll()).to.have.length(2); - }); - - }); - - describe('.nextUntil', function() { - - it('() : should return all following siblings if no selector specified', function() { - var elems = $('.apple', food).nextUntil(); - expect(elems).to.have.length(2); - expect(elems[0].attribs['class']).to.equal('orange'); - expect(elems[1].attribs['class']).to.equal('pear'); - }); - - it('() : should filter out non-element nodes', function() { - var elems = $('
        text
        '); - var div = elems.children().eq(0); - expect(div.nextUntil()).to.have.length(1); - }); - - it('() : should operate over all elements in the selection', function() { - var elems = $('.apple, .carrot', food); - expect(elems.nextUntil()).to.have.length(3); - }); - - it('() : should not contain duplicate elements', function() { - var elems = $('.apple, .orange', food); - expect(elems.nextUntil()).to.have.length(2); - }); - - it('(selector) : should return all following siblings until selector', function() { - var elems = $('.apple', food).nextUntil('.pear'); - expect(elems).to.have.length(1); - expect(elems[0].attribs['class']).to.equal('orange'); - }); - - it('(selector not sibling) : should return all following siblings', function() { - var elems = $('.apple', fruits).nextUntil('#vegetables'); - expect(elems).to.have.length(2); - }); - - it('(selector, filterString) : should return all following siblings until selector, filtered by filter', function() { - var elems = $('.beer', drinks).nextUntil('.water', '.milk'); - expect(elems).to.have.length(1); - expect(elems[0].attribs['class']).to.equal('milk'); - }); - - it('() : should return an empty object for last child', function() { - expect($('.pear', fruits).nextUntil()).to.have.length(0); - }); - - it('() : should return an empty object when called on an empty object', function() { - expect($('.banana', fruits).nextUntil()).to.have.length(0); - }); - - it('(node) : should return all following siblings until the node', function() { - var $fruits = $(fruits).children(); - var elems = $fruits.eq(0).nextUntil($fruits[2]); - expect(elems).to.have.length(1); - }); - - it('(cheerio object) : should return all following siblings until any member of the cheerio object', function() { - var $drinks = $(drinks).children(); - var $until = $([$drinks[4], $drinks[3]]); - var elems = $drinks.eq(0).nextUntil($until); - expect(elems).to.have.length(2); - }); - - }); - - describe('.prev', function() { - - it('() : should return previous element', function() { - var cls = $('.orange', fruits).prev()[0].attribs['class']; - expect(cls).to.equal('apple'); - }); - - it('(no prev) : should return empty for first child', function() { - expect($('.apple', fruits).prev()).to.have.length(0); - }); - - it('(prev on empty object) : should return empty', function() { - expect($('.banana', fruits).prev()).to.have.length(0); - }); - - it('() : should operate over all elements in the selection', function() { - expect($('.orange, .pear', food).prev()).to.have.length(2); - }); - - }); - - describe('.prevAll', function() { - - it('() : should return all preceding siblings', function() { - var elems = $('.pear', fruits).prevAll(); - expect(elems).to.have.length(2); - expect(elems[0].attribs['class']).to.equal('orange'); - expect(elems[1].attribs['class']).to.equal('apple'); - }); - - it('(no prev) : should return empty for first child', function() { - expect($('.apple', fruits).prevAll()).to.have.length(0); - }); - - it('(prevAll on empty object) : should return empty', function() { - expect($('.banana', fruits).prevAll()).to.have.length(0); - }); - - it('() : should operate over all elements in the selection', function() { - expect($('.orange, .sweetcorn', food).prevAll()).to.have.length(2); - }); - - it('() : should not contain duplicate elements', function() { - var elems = $('.orange, .pear', food); - expect(elems.prevAll()).to.have.length(2); - }); - - }); - - describe('.prevUntil', function() { - - it('() : should return all preceding siblings if no selector specified', function() { - var elems = $('.pear', fruits).prevUntil(); - expect(elems).to.have.length(2); - expect(elems[0].attribs['class']).to.equal('orange'); - expect(elems[1].attribs['class']).to.equal('apple'); - }); - - it('() : should filter out non-element nodes', function() { - var elems = $('
        text
        '); - var div = elems.children().last(); - expect(div.prevUntil()).to.have.length(1); - }); - - it('() : should operate over all elements in the selection', function() { - var elems = $('.pear, .sweetcorn', food); - expect(elems.prevUntil()).to.have.length(3); - }); - - it('() : should not contain duplicate elements', function() { - var elems = $('.orange, .pear', food); - expect(elems.prevUntil()).to.have.length(2); - }); - - it('(selector) : should return all preceding siblings until selector', function() { - var elems = $('.pear', fruits).prevUntil('.apple'); - expect(elems).to.have.length(1); - expect(elems[0].attribs['class']).to.equal('orange'); - }); - - it('(selector not sibling) : should return all preceding siblings', function() { - var elems = $('.sweetcorn', food).prevUntil('#fruits'); - expect(elems).to.have.length(1); - expect(elems[0].attribs['class']).to.equal('carrot'); - }); - - it('(selector, filterString) : should return all preceding siblings until selector, filtered by filter', function() { - var elems = $('.cider', drinks).prevUntil('.juice', '.water'); - expect(elems).to.have.length(1); - expect(elems[0].attribs['class']).to.equal('water'); - }); - - it('() : should return an empty object for first child', function() { - expect($('.apple', fruits).prevUntil()).to.have.length(0); - }); - - it('() : should return an empty object when called on an empty object', function() { - expect($('.banana', fruits).prevUntil()).to.have.length(0); - }); - - it('(node) : should return all previous siblings until the node', function() { - var $fruits = $(fruits).children(); - var elems = $fruits.eq(2).prevUntil($fruits[0]); - expect(elems).to.have.length(1); - }); - - it('(cheerio object) : should return all previous siblings until any member of the cheerio object', function() { - var $drinks = $(drinks).children(); - var $until = $([$drinks[0], $drinks[1]]); - var elems = $drinks.eq(4).prevUntil($until); - expect(elems).to.have.length(2); - }); - - }); - - describe('.siblings', function() { - - it('() : should get all the siblings', function() { - expect($('.orange', fruits).siblings()).to.have.length(2); - expect($('#fruits', fruits).siblings()).to.have.length(0); - expect($('.apple, .carrot', food).siblings()).to.have.length(3); - }); - - it('(selector) : should get all siblings that match the selector', function() { - expect($('.orange', fruits).siblings('.apple')).to.have.length(1); - expect($('.orange', fruits).siblings('.peach')).to.have.length(0); - }); - - it('(selector) : should throw a SyntaxError if given an invalid selector', function() { - expect(function() { - $('.orange', fruits).siblings(':bah'); - }).to.throwException(function(err) { - expect(err).to.be.a(SyntaxError); - }); - }); - - }); - - describe('.parents', function() { - it('() : should get all of the parents in logical order', function(){ - var result = $('.orange', food).parents(); - expect(result).to.have.length(2); - expect(result[0].attribs.id).to.be('fruits'); - expect(result[1].attribs.id).to.be('food'); - result = $('#fruits', food).parents(); - expect(result).to.have.length(1); - expect(result[0].attribs.id).to.be('food'); - }); - it('(selector) : should get all of the parents that match the selector in logical order', function() { - var result = $('.orange', food).parents('#fruits'); - expect(result).to.have.length(1); - expect(result[0].attribs.id).to.be('fruits'); - result = $('.orange', food).parents('ul'); - expect(result).to.have.length(2); - expect(result[0].attribs.id).to.be('fruits'); - expect(result[1].attribs.id).to.be('food'); - }); - it('() : should not break if the selector does not have any results', function() { - var result = $('.saladbar', food).parents(); - expect(result).to.have.length(0); - }); - it('() : should return an empty set for top-level elements', function() { - var result = $('#food', food).parents(); - expect(result).to.have.length(0); - }); - it('() : should return the parents of every element in the *reveresed* collection, omitting duplicates', function() { - var $food = $(food); - var $parents = $food.find('li').parents(); - - expect($parents).to.have.length(3); - expect($parents[0]).to.be($food.find('#vegetables')[0]); - expect($parents[1]).to.be($food[0]); - expect($parents[2]).to.be($food.find('#fruits')[0]); - }); - }); - - describe('.parent', function() { - - it('() : should return the parent of each matched element', function() { - var result = $('.orange', fruits).parent(); - expect(result).to.have.length(1); - expect(result[0].attribs.id).to.be('fruits'); - result = $('li', food).parent(); - expect(result).to.have.length(2); - expect(result[0].attribs.id).to.be('fruits'); - expect(result[1].attribs.id).to.be('vegetables'); - }); - - it('() : should return an empty object for top-level elements', function() { - var result = $('ul', fruits).parent(); - expect(result).to.have.length(0); - }); - - it('() : should not contain duplicate elements', function() { - var result = $('li', fruits).parent(); - expect(result).to.have.length(1); - }); - - it('(selector) : should filter the matched parent elements by the selector', function() { - var result = $('.orange', fruits).parent(); - expect(result).to.have.length(1); - expect(result[0].attribs.id).to.be('fruits'); - result = $('li', food).parent('#fruits'); - expect(result).to.have.length(1); - expect(result[0].attribs.id).to.be('fruits'); - }); - - }); - - describe('.closest', function() { - - it('() : should return an empty array', function() { - var result = $('.orange', fruits).closest(); - expect(result).to.have.length(0); - expect(result).to.be.a($); - }); - - it('(selector) : should find the closest element that matches the selector, searching through its ancestors and itself', function() { - expect($('.orange', fruits).closest('.apple')).to.have.length(0); - var result = $('.orange', food).closest('#food'); - expect(result[0].attribs.id).to.be('food'); - result = $('.orange', food).closest('ul'); - expect(result[0].attribs.id).to.be('fruits'); - result = $('.orange', food).closest('li'); - expect(result[0].attribs['class']).to.be('orange'); - }); - - it('(selector) : should find the closest element of each item, removing duplicates', function() { - var result = $('li', food).closest('ul'); - expect(result).to.have.length(2); - }); - - it('() : should not break if the selector does not have any results', function() { - var result = $('.saladbar', food).closest('ul'); - expect(result).to.have.length(0); - }); - - }); - - describe('.each', function() { - - it('( (i, elem) -> ) : should loop selected returning fn with (i, elem)', function() { - var items = [], - classes = ['apple', 'orange', 'pear']; - $('li', fruits).each(function(idx, elem) { - items[idx] = elem; - expect(this[0].attribs['class']).to.equal(classes[idx]); - }); - expect(items[0].attribs['class']).to.equal('apple'); - expect(items[1].attribs['class']).to.equal('orange'); - expect(items[2].attribs['class']).to.equal('pear'); - }); - - it('( (i, elem) -> ) : should break iteration when the iterator function returns false', function() { - var iterationCount = 0; - $('li', fruits).each(function(idx, elem) { - iterationCount++; - return idx < 1; - }); - - expect(iterationCount).to.equal(2); - }); - - }); - - describe('.map', function() { - it('(fn) : should be invoked with the correct arguments and context', function() { - var $fruits = $('li', fruits); - var args = []; - var thisVals = []; - - $fruits.map(function() { - args.push(arguments); - thisVals.push(this); - }); - - expect(args).to.eql([ - [0, $fruits[0]], - [1, $fruits[1]], - [2, $fruits[2]] - ]); - expect(thisVals).to.eql([ - $fruits[0], - $fruits[1], - $fruits[2] - ]); - }); - - it('(fn) : should return an Cheerio object wrapping the returned items', function() { - var $fruits = $('li', fruits); - var $mapped = $fruits.map(function(i, el) { - return $fruits[2 - i]; - }); - - expect($mapped).to.have.length(3); - expect($mapped[0]).to.be($fruits[2]); - expect($mapped[1]).to.be($fruits[1]); - expect($mapped[2]).to.be($fruits[0]); - }); - - it('(fn) : should ignore `null` and `undefined` returned by iterator', function() { - var $fruits = $('li', fruits); - var retVals = [null, undefined, $fruits[1]]; - - var $mapped = $fruits.map(function(i, el) { - return retVals[i]; - }); - - expect($mapped).to.have.length(1); - expect($mapped[0]).to.be($fruits[1]); - }); - - it('(fn) : should preform a shallow merge on arrays returned by iterator', function() { - var $fruits = $('li', fruits); - - var $mapped = $fruits.map(function(i, el) { - return [1, [3, 4]]; - }); - - expect($mapped.toArray()).to.eql([ - 1, [3, 4], - 1, [3, 4], - 1, [3, 4] - ]); - }); - - it('(fn) : should tolerate `null` and `undefined` when flattening arrays returned by iterator', function() { - var $fruits = $('li', fruits); - - var $mapped = $fruits.map(function(i, el) { - return [null, undefined]; - }); - - expect($mapped.toArray()).to.eql([ - null, undefined, - null, undefined, - null, undefined, - ]); - }); - }); - - describe('.filter', function() { - it('(selector) : should reduce the set of matched elements to those that match the selector', function() { - var pear = $('li', fruits).filter('.pear').text(); - expect(pear).to.be('Pear'); - }); - - it('(selector) : should not consider nested elements', function() { - var lis = $(fruits).filter('li'); - expect(lis).to.have.length(0); - }); - - it('(selection) : should reduce the set of matched elements to those that are contained in the provided selection', function() { - var $fruits = $('li', fruits); - var $pear = $fruits.filter('.pear, .apple'); - expect($fruits.filter($pear)).to.have.length(2); - }); - - it('(element) : should reduce the set of matched elements to those that specified directly', function() { - var $fruits = $('li', fruits); - var pear = $fruits.filter('.pear')[0]; - expect($fruits.filter(pear)).to.have.length(1); - }); - - it('(fn) : should reduce the set of matched elements to those that pass the function\'s test', function() { - var orange = $('li', fruits).filter(function(i, el) { - expect(this[0]).to.be(el); - expect(el.name).to.be('li'); - expect(i).to.be.a('number'); - return this.attr('class') === 'orange'; - }).text(); - - expect(orange).to.be('Orange'); - }); - }); - - describe('.first', function() { - - it('() : should return the first item', function() { - var $src = $('foobarbaz'); - var $elem = $src.first(); - expect($elem.length).to.equal(1); - expect($elem[0].children[0].data).to.equal('foo'); - }); - - it('() : should return an empty object for an empty object', function() { - var $src = $(); - var $first = $src.first(); - expect($first.length).to.equal(0); - expect($first[0]).to.be(undefined); - }); - - }); - - describe('.last', function() { - - it('() : should return the last element', function() { - var $src = $('foobarbaz'); - var $elem = $src.last(); - expect($elem.length).to.equal(1); - expect($elem[0].children[0].data).to.equal('baz'); - }); - - it('() : should return an empty object for an empty object', function() { - var $src = $(); - var $last = $src.last(); - expect($last.length).to.equal(0); - expect($last[0]).to.be(undefined); - }); - - }); - - describe('.first & .last', function() { - - it('() : should return equivalent collections if only one element', function() { - var $src = $('bar'); - var $first = $src.first(); - var $last = $src.last(); - expect($first.length).to.equal(1); - expect($first[0].children[0].data).to.equal('bar'); - expect($last.length).to.equal(1); - expect($last[0].children[0].data).to.equal('bar'); - expect($first[0]).to.equal($last[0]); - }); - - }); - - describe('.eq', function() { - - function getText(el) { - if(!el.length) return ''; - return el[0].children[0].data; - } - - it('(i) : should return the element at the specified index', function() { - expect(getText($('li', fruits).eq(0))).to.equal('Apple'); - expect(getText($('li', fruits).eq(1))).to.equal('Orange'); - expect(getText($('li', fruits).eq(2))).to.equal('Pear'); - expect(getText($('li', fruits).eq(3))).to.equal(''); - expect(getText($('li', fruits).eq(-1))).to.equal('Pear'); - }); - - }); - - describe('.slice', function() { - - function getText(el) { - if(!el.length) return ''; - return el[0].children[0].data; - } - - it('(start) : should return all elements after the given index', function() { - var sliced = $('li', fruits).slice(1); - expect(sliced).to.have.length(2); - expect(getText(sliced.eq(0))).to.equal('Orange'); - expect(getText(sliced.eq(1))).to.equal('Pear'); - }); - - it('(start, end) : should return all elements matching the given range', function() { - var sliced = $('li', fruits).slice(1, 2); - expect(sliced).to.have.length(1); - expect(getText(sliced.eq(0))).to.equal('Orange'); - }); - - it('(-start) : should return element matching the offset from the end', function() { - var sliced = $('li', fruits).slice(-1); - expect(sliced).to.have.length(1); - expect(getText(sliced.eq(0))).to.equal('Pear'); - }); - - }); - - describe('.end() :', function() { - var $fruits = $(fruits).children(); - - it('returns an empty object at the end of the chain', function() { - expect($fruits.end().end()).to.be.ok(); - expect($fruits.end().end()).to.have.length(0); - }); - it('find', function() { - expect($fruits.find('.apple').end()).to.be($fruits); - }); - it('filter', function() { - expect($fruits.filter('.apple').end()).to.be($fruits); - }); - it('map', function() { - expect($fruits.map(function() { return this; }).end()).to.be($fruits); - }); - it('contents', function() { - expect($fruits.contents().end()).to.be($fruits); - }); - it('eq', function() { - expect($fruits.eq(1).end()).to.be($fruits); - }); - it('first', function() { - expect($fruits.first().end()).to.be($fruits); - }); - it('last', function() { - expect($fruits.last().end()).to.be($fruits); - }); - it('slice', function() { - expect($fruits.slice(1).end()).to.be($fruits); - }); - it('children', function() { - expect($fruits.children().end()).to.be($fruits); - }); - it('parent', function() { - expect($fruits.parent().end()).to.be($fruits); - }); - it('parents', function() { - expect($fruits.parents().end()).to.be($fruits); - }); - it('closest', function() { - expect($fruits.closest('ul').end()).to.be($fruits); - }); - it('siblings', function() { - expect($fruits.siblings().end()).to.be($fruits); - }); - it('next', function() { - expect($fruits.next().end()).to.be($fruits); - }); - it('nextAll', function() { - expect($fruits.nextAll().end()).to.be($fruits); - }); - it('prev', function() { - expect($fruits.prev().end()).to.be($fruits); - }); - it('prevAll', function() { - expect($fruits.prevAll().end()).to.be($fruits); - }); - it('clone', function() { - expect($fruits.clone().end()).to.be($fruits); - }); - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.utils.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.utils.js deleted file mode 100644 index 348aae38..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/api.utils.js +++ /dev/null @@ -1,162 +0,0 @@ -var expect = require('expect.js'), - fixtures = require('./fixtures'), - $ = require('../'); - - -describe('$', function() { - - describe('.html', function() { - - it('() : should return innerHTML; $.html(obj) should return outerHTML', function() { - var $div = $('div', '
        foobar
        '); - var span = $div.children()[1]; - expect($(span).html()).to.equal('bar'); - expect($.html(span)).to.equal('bar'); - }); - - it('() : should accept an object, an array, or a cheerio object', function() { - var $span = $('foo'); - expect($.html($span[0])).to.equal('foo'); - expect($.html($span)).to.equal('foo'); - }); - - it('() : should be able to set to an empty string', function() { - var $elem = $('foo').html(''); - expect($.html($elem)).to.equal(''); - }); - - it('() : of empty cheerio object should return null', function() { - expect($().html()).to.be(null); - }); - - it('(selector) : should return the outerHTML of the selected element', function() { - var _$ = $.load(fixtures.fruits); - expect(_$.html('.pear')).to.equal('
      • Pear
      • '); - }); - }); - - - - describe('.load', function() { - - it('(html) : should retain original root after creating a new node', function() { - var $html = $.load('
          '); - expect($html('body')).to.have.length(1); - $html('', { xmlMode : true }); - // console.log($html('script')[0].type); - // expect($html('script')[0].type).to.be('tag'); - // }); - - }); - - - describe('.clone', function() { - - it('() : should return a copy', function() { - var $src = $('
          foobarbaz
          ').children(); - var $elem = $src.clone(); - expect($elem.length).to.equal(3); - expect($elem.parent()).to.have.length(0); - expect($elem.text()).to.equal($src.text()); - $src.text('rofl'); - expect($elem.text()).to.not.equal($src.text()); - }); - - }); - - describe('.parseHTML', function() { - - it('() : returns null', function() { - expect($.parseHTML()).to.equal(null); - }); - - it('(null) : returns null', function() { - expect($.parseHTML(null)).to.equal(null); - }); - - it('("") : returns null', function() { - expect($.parseHTML('')).to.equal(null); - }); - - it('(largeHtmlString) : parses large HTML strings', function() { - var html = new Array(10).join('
          '); - var nodes = $.parseHTML(html); - - expect(nodes.length).to.be.greaterThan(4); - expect(nodes).to.be.an('array'); - }); - - it('("'; - expect($.parseHTML(html)).to.have.length(0); - }); - - it('("'; - expect($.parseHTML(html, true)[0].name).to.match(/script/i); - }); - - it('("scriptAndNonScript) : preserves non-script nodes', function() { - var html = '
          '; - expect($.parseHTML(html)[0].name).to.match(/div/i); - }); - - it('(scriptAndNonScript, true) : Preserves script position', function() { - var html = '
          '; - expect($.parseHTML(html, true)[0].name).to.match(/script/i); - }); - - it('(text) : returns a text node', function() { - expect($.parseHTML('text')[0].type).to.be('text'); - }); - - it('(\\ttext) : preserves leading whitespace', function() { - expect($.parseHTML('\t
          ')[0].data).to.equal('\t'); - }); - - it('( text) : Leading spaces are treated as text nodes', function() { - expect($.parseHTML('
          ')[0].type).to.be('text'); - }); - - it('(html) : should preserve content', function() { - var html = '
          test div
          '; - expect($($.parseHTML(html)[0]).html()).to.equal('test div'); - }); - - it('(malformedHtml) : should not break', function() { - expect($.parseHTML('')).to.have.length(1); - }); - - it('(garbageInput) : should not cause an error', function() { - expect($.parseHTML('<#if>

          This is a test.

          <#/if>') || true).to.be.ok(); - }); - - }); - - describe('.root', function() { - - it('() : should return a cheerio-wrapped root object', function() { - var $html = $.load('
          foobar
          '); - $html.root().append('
          '); - expect($html.html()).to.equal('
          foobar
          '); - }); - - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/cheerio.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/cheerio.js deleted file mode 100644 index 17869585..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/cheerio.js +++ /dev/null @@ -1,223 +0,0 @@ -var expect = require('expect.js'), - _ = require('underscore'), - $ = require('../'), - fixtures = require('./fixtures'), - fruits = fixtures.fruits, - food = fixtures.food; - -// HTML -var script = '', - multiclass = '

          Save

          '; - -describe('cheerio', function() { - - it('should get the version', function() { - expect(/\d+\.\d+\.\d+/.test($.version)).to.be.ok(); - }); - - it('$(null) should return be empty', function() { - expect($(null)).to.be.empty(); - }); - - it('$(undefined) should be empty', function() { - expect($(undefined)).to.be.empty(); - }); - - it('$(null) should be empty', function() { - expect($('')).to.be.empty(); - }); - - it('$(selector) with no context or root should be empty', function() { - expect($('.h2')).to.be.empty(); - expect($('#fruits')).to.be.empty(); - }); - - it('$(node) : should override previously-loaded nodes', function() { - var C = $.load('
          '); - var spanNode = C('span')[0]; - var $span = C(spanNode); - expect($span[0]).to.equal(spanNode); - }); - - it('should be able to create html without a root or context', function() { - var $h2 = $('

          '); - expect($h2).to.not.be.empty(); - expect($h2).to.have.length(1); - expect($h2[0].name).to.equal('h2'); - }); - - it('should be able to create complicated html', function() { - var $script = $(script); - expect($script).to.not.be.empty(); - expect($script).to.have.length(1); - expect($script[0].attribs.src).to.equal('script.js'); - expect($script[0].attribs.type).to.equal('text/javascript'); - expect($script[0].children).to.be.empty(); - }); - - var testAppleSelect = function($apple) { - expect($apple).to.have.length(1); - $apple = $apple[0]; - expect($apple.parent.name).to.equal('ul'); - expect($apple.prev).to.be(null); - expect($apple.next.attribs['class']).to.equal('orange'); - expect($apple.children).to.have.length(1); - expect($apple.children[0].data).to.equal('Apple'); - }; - - it('should be able to select .apple with only a context', function() { - var $apple = $('.apple', fruits); - testAppleSelect($apple); - }); - - it('should be able to select .apple with only a root', function() { - var $apple = $('.apple', null, fruits); - testAppleSelect($apple); - }); - - it('should be able to select an id', function() { - var $fruits = $('#fruits', null, fruits); - expect($fruits).to.have.length(1); - expect($fruits[0].attribs.id).to.equal('fruits'); - }); - - it('should be able to select a tag', function() { - var $ul = $('ul', fruits); - expect($ul).to.have.length(1); - expect($ul[0].name).to.equal('ul'); - }); - - it('should be able to filter down using the context', function() { - var q = $.load(fruits), - apple = q('.apple', 'ul'), - lis = q('li', 'ul'); - - expect(apple).to.have.length(1); - expect(lis).to.have.length(3); - }); - - it('should select only elements inside given context (Issue #193)', function() { - var q = $.load(food), - fruits = q('#fruits'), - fruitElements = q('li', fruits); - - expect(fruitElements).to.have.length(3); - }); - - it('should be able to select multiple tags', function() { - var $fruits = $('li', null, fruits); - expect($fruits).to.have.length(3); - var classes = ['apple', 'orange', 'pear']; - $fruits.each(function(idx, $fruit) { - expect($fruit.attribs['class']).to.equal(classes[idx]); - }); - }); - - it('should be able to do: $("#fruits .apple")', function() { - var $apple = $('#fruits .apple', fruits); - testAppleSelect($apple); - }); - - it('should be able to do: $("li.apple")', function() { - var $apple = $('li.apple', fruits); - testAppleSelect($apple); - }); - - it('should be able to select by attributes', function() { - var $apple = $('li[class=apple]', fruits); - testAppleSelect($apple); - }); - - it('should be able to select multiple classes: $(".btn.primary")', function() { - var $a = $('.btn.primary', multiclass); - expect($a).to.have.length(1); - expect($a[0].children[0].data).to.equal('Save'); - }); - - it('should not create a top-level node', function() { - var $elem = $('* div', '
          '); - expect($elem).to.have.length(0); - }); - - it('should be able to select multiple elements: $(".apple, #fruits")', function() { - var $elems = $('.apple, #fruits', fruits); - expect($elems).to.have.length(2); - - var $apple = _($elems).filter(function(elem) { - return elem.attribs['class'] === 'apple'; - }); - var $fruits = _($elems).filter(function(elem) { - return elem.attribs.id === 'fruits'; - }); - testAppleSelect($apple); - expect($fruits[0].attribs.id).to.equal('fruits'); - }); - - it('should select first element $(:first)'); - // var $elem = $(':first', fruits); - // var $h2 = $('

          fruits

          '); - // console.log($elem.before('hi')); - // console.log($elem.before($h2)); - - it('should be able to select immediate children: $("#fruits > .pear")', function() { - var $food = $(food); - $('.pear', $food).append('
        • Another Pear!
        • '); - expect($('#fruits .pear', $food)).to.have.length(2); - var $elem = $('#fruits > .pear', $food); - expect($elem).to.have.length(1); - expect($elem.attr('class')).to.equal('pear'); - }); - - it('should be able to select immediate children: $(".apple + .pear")', function() { - var $elem = $('.apple + li', fruits); - expect($elem).to.have.length(1); - $elem = $('.apple + .pear', fruits); - expect($elem).to.have.length(0); - $elem = $('.apple + .orange', fruits); - expect($elem).to.have.length(1); - expect($elem.attr('class')).to.equal('orange'); - }); - - it('should be able to select immediate children: $(".apple ~ .pear")', function() { - var $elem = $('.apple ~ li', fruits); - expect($elem).to.have.length(2); - $elem = $('.apple ~ .pear', fruits); - expect($elem.attr('class')).to.equal('pear'); - }); - - it('should handle wildcards on attributes: $("li[class*=r]")', function() { - var $elem = $('li[class*=r]', fruits); - expect($elem).to.have.length(2); - expect($elem.eq(0).attr('class')).to.equal('orange'); - expect($elem.eq(1).attr('class')).to.equal('pear'); - }); - - it('should handle beginning of attr selectors: $("li[class^=o]")', function() { - var $elem = $('li[class^=o]', fruits); - expect($elem).to.have.length(1); - expect($elem.eq(0).attr('class')).to.equal('orange'); - }); - - it('should handle beginning of attr selectors: $("li[class$=e]")', function() { - var $elem = $('li[class$=e]', fruits); - expect($elem).to.have.length(2); - expect($elem.eq(0).attr('class')).to.equal('apple'); - expect($elem.eq(1).attr('class')).to.equal('orange'); - }); - - it('should gracefully degrade on complex, unmatched queries', function() { - var $elem = $('Eastern States Cup #8-fin 
          Downhill '); - expect($elem).to.have.length(0); // [] - }); - - it('(extended Array) should not interfere with prototype methods (issue #119)', function() { - var extended = []; - var custom = extended.find = extended.children = extended.each = function() {}; - var $empty = $(extended); - - expect($empty.find).to.be($.prototype.find); - expect($empty.children).to.be($.prototype.children); - expect($empty.each).to.be($.prototype.each); - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/fixtures.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/fixtures.js deleted file mode 100644 index 0762f127..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/fixtures.js +++ /dev/null @@ -1,53 +0,0 @@ -/* jshint indent: false */ -exports.fruits = [ - '
            ', - '
          • Apple
          • ', - '
          • Orange
          • ', - '
          • Pear
          • ', - '
          ' -].join(''); - -exports.vegetables = [ - '
            ', - '
          • Carrot
          • ', - '
          • Sweetcorn
          • ', - '
          ' -].join(''); - -exports.chocolates = [ - '
            ', - '
          • Linth
          • ', - '
          • Frey
          • ', - '
          • Cailler
          • ', - '
          ' -].join(''); - -exports.drinks = [ - '
            ', - '
          • Beer
          • ', - '
          • Juice
          • ', - '
          • Milk
          • ', - '
          • Water
          • ', - '
          • Cider
          • ', - '
          ' -].join(''); - -exports.food = [ - '
            ', - exports.fruits, - exports.vegetables, - '
          ' -].join(''); - -exports.inputs = [ - '', - '', - '', - '', - '' -].join(''); - -exports.text = [ - '

          Apples, oranges and pears.

          ', - '

          Carrots and

          ' -].join(''); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/mocha.opts b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/mocha.opts deleted file mode 100644 index 9431de4c..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---reporter list ---growl \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/parse.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/parse.js deleted file mode 100644 index ab6eacc7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/parse.js +++ /dev/null @@ -1,217 +0,0 @@ -var expect = require('expect.js'), - parse = require('../lib/parse'); - - -// Tags -var basic = ''; -var siblings = '

          '; - -// Single Tags -var single = '
          '; -var singleWrong = '
          '; - -// Children -var children = '
          '; -var li = '
        • Durian
        • '; - -// Attributes -var attributes = 'man waving'; -var noValueAttribute = ''; - -// Comments -var comment = ''; -var conditional = ''; - -// Text -var text = 'lorem ipsum'; - -// Script -var script = ''; -var scriptEmpty = ''; - -// Style -var style = ''; -var styleEmpty = ''; - -// Directives -var directive = ''; - - -describe('parse', function() { - - describe('.eval', function() { - - it('should parse basic empty tags: ' + basic, function() { - var tag = parse.evaluate(basic)[0]; - expect(tag.type).to.equal('tag'); - expect(tag.name).to.equal('html'); - expect(tag.children).to.be.empty(); - }); - - it('should handle sibling tags: ' + siblings, function() { - var dom = parse.evaluate(siblings), - h2 = dom[0], - p = dom[1]; - - expect(dom).to.have.length(2); - expect(h2.name).to.equal('h2'); - expect(p.name).to.equal('p'); - }); - - it('should handle single tags: ' + single, function() { - var tag = parse.evaluate(single)[0]; - expect(tag.type).to.equal('tag'); - expect(tag.name).to.equal('br'); - expect(tag.children).to.be.empty(); - }); - - it('should handle malformatted single tags: ' + singleWrong, function() { - var tag = parse.evaluate(singleWrong)[0]; - expect(tag.type).to.equal('tag'); - expect(tag.name).to.equal('br'); - expect(tag.children).to.be.empty(); - }); - - it('should handle tags with children: ' + children, function() { - var tag = parse.evaluate(children)[0]; - expect(tag.type).to.equal('tag'); - expect(tag.name).to.equal('html'); - expect(tag.children).to.be.ok(); - expect(tag.children).to.have.length(1); - }); - - it('should handle tags with children: ' + li, function() { - var tag = parse.evaluate(li)[0]; - expect(tag.children).to.have.length(1); - expect(tag.children[0].data).to.equal('Durian'); - }); - - it('should handle tags with attributes: ' + attributes, function() { - var attrs = parse.evaluate(attributes)[0].attribs; - expect(attrs).to.be.ok(); - expect(attrs.src).to.equal('hello.png'); - expect(attrs.alt).to.equal('man waving'); - }); - - it('should handle value-less attributes: ' + noValueAttribute, function() { - var attrs = parse.evaluate(noValueAttribute)[0].attribs; - expect(attrs).to.be.ok(); - expect(attrs.disabled).to.equal(''); - }); - - it('should handle comments: ' + comment, function() { - var elem = parse.evaluate(comment)[0]; - expect(elem.type).to.equal('comment'); - expect(elem.data).to.equal(' sexy '); - }); - - it('should handle conditional comments: ' + conditional, function() { - var elem = parse.evaluate(conditional)[0]; - expect(elem.type).to.equal('comment'); - expect(elem.data).to.equal(conditional.replace('', '')); - }); - - it('should handle text: ' + text, function() { - var text_ = parse.evaluate(text)[0]; - expect(text_.type).to.equal('text'); - expect(text_.data).to.equal('lorem ipsum'); - }); - - it('should handle script tags: ' + script, function() { - var script_ = parse.evaluate(script)[0]; - expect(script_.type).to.equal('script'); - expect(script_.name).to.equal('script'); - expect(script_.attribs.type).to.equal('text/javascript'); - expect(script_.children).to.have.length(1); - expect(script_.children[0].type).to.equal('text'); - expect(script_.children[0].data).to.equal('alert("hi world!");'); - }); - - it('should handle style tags: ' + style, function() { - var style_ = parse.evaluate(style)[0]; - expect(style_.type).to.equal('style'); - expect(style_.name).to.equal('style'); - expect(style_.attribs.type).to.equal('text/css'); - expect(style_.children).to.have.length(1); - expect(style_.children[0].type).to.equal('text'); - expect(style_.children[0].data).to.equal(' h2 { color:blue; } '); - }); - - it('should handle directives: ' + directive, function() { - var elem = parse.evaluate(directive)[0]; - expect(elem.type).to.equal('directive'); - expect(elem.data).to.equal('!doctype html'); - expect(elem.name).to.equal('!doctype'); - }); - - }); - - describe('.parse', function() { - - // root test utility - function rootTest(root) { - expect(root.name).to.equal('root'); - - // Should exist but be null - expect(root.next).to.be(null); - expect(root.prev).to.be(null); - expect(root.parent).to.be(null); - - var child = root.children[0]; - expect(child.parent).to.be(null); - } - - it('should add root to: ' + basic, function() { - var root = parse(basic); - rootTest(root); - expect(root.children).to.have.length(1); - expect(root.children[0].name).to.equal('html'); - }); - - it('should add root to: ' + siblings, function() { - var root = parse(siblings); - rootTest(root); - expect(root.children).to.have.length(2); - expect(root.children[0].name).to.equal('h2'); - expect(root.children[1].name).to.equal('p'); - expect(root.children[1].parent).to.equal(null); - }); - - it('should add root to: ' + comment, function() { - var root = parse(comment); - rootTest(root); - expect(root.children).to.have.length(1); - expect(root.children[0].type).to.equal('comment'); - }); - - it('should add root to: ' + text, function() { - var root = parse(text); - rootTest(root); - expect(root.children).to.have.length(1); - expect(root.children[0].type).to.equal('text'); - }); - - it('should add root to: ' + scriptEmpty, function() { - var root = parse(scriptEmpty); - rootTest(root); - expect(root.children).to.have.length(1); - expect(root.children[0].type).to.equal('script'); - }); - - it('should add root to: ' + styleEmpty, function() { - var root = parse(styleEmpty); - rootTest(root); - expect(root.children).to.have.length(1); - expect(root.children[0].type).to.equal('style'); - }); - - it('should add root to: ' + directive, function() { - var root = parse(directive); - rootTest(root); - expect(root.children).to.have.length(1); - expect(root.children[0].type).to.equal('directive'); - }); - - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/render.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/render.js deleted file mode 100644 index 02425096..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/render.js +++ /dev/null @@ -1,62 +0,0 @@ -var expect = require('expect.js'), - parse = require('../lib/parse'), - render = require('../lib/render'); - -var html = function(str, options) { - options = options || {}; - var dom = parse(str, options); - return render(dom); -}; - -describe('render', function() { - - describe('(html)', function() { - - it('should render
          tags correctly', function() { - var str = '
          '; - expect(html(str)).to.equal('
          '); - }); - - it('should handle double quotes within single quoted attributes properly', function() { - var str = '
          '; - expect(html(str)).to.equal('
          '); - }); - - it('should retain encoded HTML content within attributes', function() { - var str = '
          '; - expect(html(str)).to.equal('
          '); - }); - - it('should shorten the "checked" attribute when it contains the value "checked"', function() { - var str = ''; - expect(html(str)).to.equal(''); - }); - - it('should not shorten the "name" attribute when it contains the value "name"', function() { - var str = ''; - expect(html(str)).to.equal(''); - }); - - it('should render comments correctly', function() { - var str = ''; - expect(html(str)).to.equal(''); - }); - - it('should render whitespace by default', function() { - var str = 'hi
          blah'; - expect(html(str)).to.equal(str); - }); - - it('should normalize whitespace if specified', function() { - var str = 'hi blah '; - expect(html(str, { normalizeWhitespace: true })).to.equal('hi blah '); - }); - - it('should preserve multiple hyphens in data attributes', function() { - var str = '
          '; - expect(html(str)).to.equal('
          '); - }); - - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/utilities.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/utilities.js deleted file mode 100644 index 84171665..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/utilities.js +++ /dev/null @@ -1,33 +0,0 @@ -var expect = require('expect.js'), - $ = require('../'), - food = require('./fixtures').food; - -describe('utility methods', function() { - - describe('.contains', function() { - - it('(container, contained) : should correctly detect the provided element', function() { - var $food = $(food); - var $fruits = $food.find('#fruits'); - var $apple = $fruits.find('.apple'); - - expect($.contains($food[0], $fruits[0])).to.equal(true); - expect($.contains($food[0], $apple[0])).to.equal(true); - }); - - it('(container, other) : should not detect elements that are not contained', function() { - var $food = $(food); - var $fruits = $food.find('#fruits'); - var $vegetables = $food.find('#vegetables'); - var $apple = $fruits.find('.apple'); - - expect($.contains($vegetables[0], $apple[0])).to.equal(false); - expect($.contains($fruits[0], $vegetables[0])).to.equal(false); - expect($.contains($vegetables[0], $fruits[0])).to.equal(false); - expect($.contains($fruits[0], $fruits[0])).to.equal(false); - expect($.contains($vegetables[0], $vegetables[0])).to.equal(false); - }); - - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/xml.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/xml.js deleted file mode 100644 index d3a0bea6..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/cheerio/test/xml.js +++ /dev/null @@ -1,27 +0,0 @@ -var expect = require('expect.js'), - _ = require('underscore'), - cheerio = require('../lib/cheerio'); - -var xml = function(str, options) { - options = _.extend({ xmlMode: true }, options); - var dom = cheerio.load(str, options); - return dom.xml(); -}; - -describe('render', function() { - - describe('(xml)', function() { - - it('should render tags correctly', function() { - var str = ''; - expect(xml(str)).to.equal(''); - }); - - it('should render tags (RSS) correctly', function() { - var str = 'http://www.github.com/'; - expect(xml(str)).to.equal('http://www.github.com/'); - }); - - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/.npmignore deleted file mode 100644 index 78cdbf85..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log -node_modules diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/README.md deleted file mode 100644 index ed53ccf8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# hyperdirect - -Follow redirects for hyperquest GET requests. Process all other requests exactly as normal. - -## Installation - - $ npm install hyperdirect - -## Usage - -```js -//basic usage -var request = require('hyperquest').request; - -request('https://github.com/ForbesLindesay/hyperdirect/archive/master.tar.gz') - .pipe(require('fs').createWriteStream(__dirname + '/hyperdirect.tar.gz')); - -//moderate usage -var request = require('hyperquest')(2/* Max Redirects to follow, defaults to 10 */); - -request('https://github.com/ForbesLindesay/hyperdirect/archive/master.tar.gz') - .pipe(require('fs').createWriteStream(__dirname + '/hyperdirect.tar.gz')); - -//advanced usage -var hyperdirect = require('hyperdirect')(5, require('hyperquest')); -``` - -## API - -### hyperdirect(maxRedirects, subquest) - -Returns a new function with the same API as [hyperquest](https://github.com/hyperquest/hyperquest) but which follows redirects for GET requests. Both `maxRedirects` and `subquest` are optional and can be in either order. - -If provided, `subquest` should be a function which matches the API of [hyperquest](https://github.com/hyperquest/hyperquest) or an object of the form `{request: hyperquest}` where `hyperquest` is a function matching the API of [hyperquest](https://github.com/hyperquest/hyperquest). - -`maxRedirects` will default to `10`. Once the request has been redirected more times than that it will give up and throw an error. The error has a `res` and `statusCode` property set to the apropriate properties from the last request made. - -The returned stream will emit `redirect` events with the response of any request that results in another redirect. This means you could trace the path something a request took by doing: - -```js -require('hyperdirect')(100)(url) - .on('redirect', function (res) { - console.log('REDIRECT ' + res.statusCode + ': ' + res.headers.location); - }) - .on('response', function (res) { - console.log('FINAL URL: ' + res.url); - }); -``` - -### hyperdirect.request(uri, opts, cb) - -Follows exactly the same API as [hyperquest](https://github.com/hyperquest/hyperquest) but automatically follows up to 10 redirects for GET requests. It's the same as what you get by calling `hyperdirect()`. - -## License - -MIT \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/index.js deleted file mode 100644 index d2da4bc4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/index.js +++ /dev/null @@ -1,68 +0,0 @@ -var through = require('through'); -var hyperquest = require('hyperquest'); - -module.exports = direct; -module.exports.request = direct(hyperquest); - -function direct(subquest, maxRedirects) { - if (typeof subquest === 'number') { - var tmp = subquest; - subquest = maxRedirects; - maxRedirects = tmp; - } - if (subquest === undefined) subquest = hyperquest; - if (maxRedirects === undefined) maxRedirects = 10; - if (typeof subquest.request === 'function') subquest = subquest.request; - if (subquest.isCap) throw new Error('The subquest argument "' + subquest + '" was invalid. You must use a valid hyperquest module that is not a cap.'); - function request(uri, opts, cb) { - if (typeof uri === 'object') { - cb = opts; - opts = uri; - uri = undefined; - } - if (typeof opts === 'function') { - cb = opts; - opts = undefined; - } - if (!opts) opts = {}; - if (uri !== undefined) opts.uri = uri; - - var method = (opts.method || 'GET').toUpperCase(); - if (method != 'GET') return subquest(opts, cb); - - var rs = through(); - var remainingRedirects = maxRedirects; - function doRequest() { - if (remainingRedirects < 0) { - rs.emit('error', new Error('The response was redirected ' + (maxRedirects + 1) + ' times and the `maxRedirects` option was set to ' + maxRedirects)) - } - subquest(opts, function (err, res) { - if (err) return rs.emit('error', err); - res.url = opts.uri; - if (isRedirect(res.statusCode)) { - remainingRedirects--; - rs.emit('redirect', res); - opts.uri = res.headers.location; - return doRequest(); - } - rs.emit('response', res); - this.pipe(rs); - }); - } - doRequest(); - - if (cb) { - rs.on('error', cb); - rs.on('response', function (res) { - cb.call(rs, null, res); - }); - } - return rs; - } - request.request = request; - return request; -} - -function isRedirect(statusCode) { - return statusCode === 301 || statusCode === 302 || statusCode === 307 || statusCode === 308; -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/.travis.yml deleted file mode 100644 index dad2273c..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.8 - - "0.10" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/LICENSE deleted file mode 100644 index ee27ba4b..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/example/req.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/example/req.js deleted file mode 100644 index 2d73de7e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/example/req.js +++ /dev/null @@ -1,2 +0,0 @@ -var hyperquest = require('../'); -hyperquest('http://localhost:8000').pipe(process.stdout); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/index.js deleted file mode 100644 index 73d66748..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/index.js +++ /dev/null @@ -1,139 +0,0 @@ -var url = require('url'); -var http = require('http'); -var https = require('https'); -var through = require('through'); -var duplexer = require('duplexer'); - -module.exports = hyperquest; - -function bind (obj, fn) { - var args = Array.prototype.slice.call(arguments, 2); - return function () { - var argv = args.concat(Array.prototype.slice.call(arguments)); - return fn.apply(obj, argv); - } -} - -function hyperquest (uri, opts, cb, extra) { - if (typeof uri === 'object') { - cb = opts; - opts = uri; - uri = undefined; - } - if (typeof opts === 'function') { - cb = opts; - opts = undefined; - } - if (!opts) opts = {}; - if (uri !== undefined) opts.uri = uri; - if (extra) opts.method = extra.method; - - var req = new Req(opts); - var ws = req.duplex && through(); - if (ws) ws.pause(); - var rs = through(); - - var dup = req.duplex ? duplexer(ws, rs) : rs; - if (!req.duplex) { - rs.writable = false; - } - dup.request = req; - dup.setHeader = bind(req, req.setHeader); - dup.setLocation = bind(req, req.setLocation); - - var closed = false; - dup.on('close', function () { closed = true }); - - process.nextTick(function () { - if (closed) return; - dup.on('close', function () { r.destroy() }); - - var r = req._send(); - r.on('error', bind(dup, dup.emit, 'error')); - - r.on('response', function (res) { - dup.response = res; - dup.emit('response', res); - if (req.duplex) res.pipe(rs) - else { - res.on('data', function (buf) { rs.queue(buf) }); - res.on('end', function () { rs.queue(null) }); - } - }); - - if (req.duplex) { - ws.pipe(r); - ws.resume(); - } - else r.end(); - }); - - if (cb) { - dup.on('error', cb); - dup.on('response', bind(dup, cb, null)); - } - return dup; -} - -hyperquest.get = hyperquest; - -hyperquest.post = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'POST' }); -}; - -hyperquest.put = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'PUT' }); -}; - -hyperquest['delete'] = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'DELETE' }); -}; - -function Req (opts) { - this.headers = opts.headers || {}; - - var method = (opts.method || 'GET').toUpperCase(); - this.method = method; - this.duplex = !(method === 'GET' || method === 'DELETE' - || method === 'HEAD'); - this.auth = opts.auth; - - if (opts.uri) this.setLocation(opts.uri); -} - -Req.prototype._send = function () { - this._sent = true; - - var headers = this.headers || {}; - var u = url.parse(this.uri); - var au = u.auth || this.auth; - if (au) { - headers.authorization = 'Basic ' + Buffer(au).toString('base64'); - } - - var protocol = u.protocol || ''; - var iface = protocol === 'https:' ? https : http; - var req = iface.request({ - scheme: protocol.replace(/:$/, ''), - method: this.method, - host: u.hostname, - port: Number(u.port), - path: u.path, - agent: false, - headers: headers - }); - - if (req.setTimeout) req.setTimeout(Math.pow(2, 32) * 1000); - return req; -}; - -Req.prototype.setHeader = function (key, value) { - if (this._sent) throw new Error('request already sent'); - this.headers[key] = value; - return this; -}; - -Req.prototype.setLocation = function (uri) { - this.uri = uri; - return this; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/package.json deleted file mode 100644 index 621c7a57..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "hyperquest", - "version": "0.1.8", - "description": "make streaming http requests", - "main": "index.js", - "dependencies": { - "through": "~2.2.0", - "duplexer": "~0.1.0" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "scripts": { - "test": "tap test/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/substack/hyperquest.git" - }, - "homepage": "https://github.com/substack/hyperquest", - "keywords": [ - "stream", - "http", - "transport", - "request", - "get", - "post", - "put", - "delete", - "duplex", - "pooling" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "license": "MIT", - "readme": "# hyperquest\n\ntreat http requests as a streaming transport\n\n[![build status](https://secure.travis-ci.org/substack/hyperquest.png)](http://travis-ci.org/substack/hyperquest)\n\nThe hyperquest api is a subset of [request](https://github.com/mikeal/request).\n\nThis module works in the browser with [browserify](http://browserify.org).\n\n# rant\n\n![animated gif rant](http://substack.net/images/substack.gif)\n\nThis module disables a lot of infuriating things about core http that WILL cause\nbugs in your application if you think of http as just another kind of stream:\n\n* http requests have a default idle timeout of 2 minutes. This is terrible if\nyou just want to pipe together a bunch of persistent backend processes over\nhttp.\n\n* There is a default connection pool of 5 requests. If you have 5 or more extant\nhttp requests, any additional requests will HANG for NO GOOD REASON.\n\nhyperquest turns these annoyances off so you can just pretend that core http is\njust a fancier version of tcp and not the horrible monstrosity that it actually\nis.\n\nI have it on good authority that these annoyances will be fixed in node 0.12.\n\n# example\n\n# simple streaming GET\n\n``` js\nvar hyperquest = require('hyperquest');\nhyperquest('http://localhost:8000').pipe(process.stdout);\n```\n\n```\n$ node example/req.js\nbeep boop\n```\n\n# pooling is evil\n\nNow to drive the point home about pooling being evil and almost always never\nwhat you want ever.\n\n[request](https://github.com/mikeal/request)\nhas its own forever agent thing that works pretty much the same as node core\nhttp.request: the wrong, horrible, broken way.\n\nFor instance, the following request code takes 12+ seconds to finish:\n\n``` js\nvar http = require('http');\nvar request = require('request');\n\nvar server = http.createServer(function (req, res) {\n res.write(req.url.slice(1) + '\\n');\n setTimeout(res.end.bind(res), 3000);\n});\n\nserver.listen(5000, function () {\n var pending = 20;\n for (var i = 0; i < 20; i++) {\n var r = request('http://localhost:5000/' + i);\n r.pipe(process.stdout, { end: false });\n r.on('end', function () {\n if (--pending === 0) server.close();\n });\n }\n});\n\nprocess.stdout.setMaxListeners(0); // turn off annoying warnings\n```\n\n```\nsubstack : example $ time node many_request.js \n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\nreal 0m12.423s\nuser 0m0.424s\nsys 0m0.048s\n```\n\nSurprising? YES. This is pretty much never what you want, particularly if you\nhave a lot of streaming http API endpoints. Your code will just *HANG* once the\nconnection pool fills up and it won't start working again until some connections\ndie for whatever reason. I have encountered this so many times in production\ninstances and it is SO hard to track down reliably.\n\nCompare to using hyperquest, which is exactly the same code but it takes 3\nseconds instead of 12 to finish because it's not completely self-crippled like\nrequest and core http.request.\n\n``` js\nvar http = require('http');\nvar hyperquest = require('hyperquest');\n\nvar server = http.createServer(function (req, res) {\n res.write(req.url.slice(1) + '\\n');\n setTimeout(res.end.bind(res), 3000);\n});\n\nserver.listen(5000, function () {\n var pending = 20;\n for (var i = 0; i < 20; i++) {\n var r = hyperquest('http://localhost:5000/' + i);\n r.pipe(process.stdout, { end: false });\n r.on('end', function () {\n if (--pending === 0) server.close();\n });\n }\n});\n\nprocess.stdout.setMaxListeners(0); // turn off annoying warnings\n```\n```\n$ time node many_hyperquest.js \n0\n1\n2\n3\n4\n5\n6\n8\n9\n7\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\nreal 0m3.284s\nuser 0m0.288s\nsys 0m0.060s\n```\n\nSo the other thing is, the justification I've heard supporting this horrible\nlimit-of-5 pooling behavior is \"performance\". The first example which has been\ntuned for \"performance\" takes 12 seconds. The second example that removes these\n\"performance\" enhancements takes 3. Some performance improvement INDEED!\n\n# methods\n\n``` js\nvar hyperquest = require('hyperquest');\n```\n\n## var req = hyperquest(uri, opts={}, cb)\n\nCreate an outgoing http request to `uri` or `opts.uri`.\nYou need not pass any arguments here since there are setter methods documented\nbelow.\n\nReturn a readable or duplex stream depending on the `opts.method`.\n\nDefault option values:\n\n* opts.method - `\"GET\"`\n* opts.headers - `{}`\n* opts.auth - undefined, but is set automatically when the `uri` has an auth\nstring in it such as `\"http://user:passwd@host\"`. `opts.auth` is of the form\n`\"user:pass\"`, just like `http.request()`.\n\nThe request does not go through until the `nextTick` so you can set values\noutside of the `opts` so long as they are called on the same tick.\n\nOptionally you can pass a `cb(err, res)` to set up listeners for `'error'` and\n`'response'` events in one place.\n\nNote that the optional `cb` is NOT like\n[request](https://github.com/mikeal/request)\nin that hyperquest will not buffer content for you or decode to json or any such\nmagical thing.\n\n## req.setHeader(key, value);\n\nSet an outgoing header `key` to `value`.\n\n## req.setLocation(uri);\n\nSet the location if you didn't specify it in the `hyperquest()` call.\n\n## var req = hyperquest.get(uri, opts, cb)\n\nReturn a readable stream from `hyperquest(..., { method: 'GET' })`.\n\n## var req = hyperquest.put(uri, opts, cb)\n\nReturn a duplex stream from `hyperquest(..., { method: 'PUT' })`.\n\n## var req = hyperquest.post(uri, opts, cb)\n\nReturn a duplex stream from `hyperquest(..., { method: 'POST' })`.\n\n## var req = hyperquest.delete(uri, opts, cb)\n\nReturn a readable stream from `hyperquest(..., { method: 'DELETE' })`.\n\n# events\n\n## req.on('response', function (res) {})\n\nThe `'response'` event is forwarded from the underlying `http.request()`.\n\n## req.on('error', function (res) {})\n\nThe `'error'` event is forwarded from the underlying `http.request()`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install hyperquest\n```\n\n# license\n\nMIT\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/substack/hyperquest/issues" - }, - "_id": "hyperquest@0.1.8", - "_from": "hyperquest@~0.1.5" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/readme.markdown b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/readme.markdown deleted file mode 100644 index af7bdf01..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/readme.markdown +++ /dev/null @@ -1,249 +0,0 @@ -# hyperquest - -treat http requests as a streaming transport - -[![build status](https://secure.travis-ci.org/substack/hyperquest.png)](http://travis-ci.org/substack/hyperquest) - -The hyperquest api is a subset of [request](https://github.com/mikeal/request). - -This module works in the browser with [browserify](http://browserify.org). - -# rant - -![animated gif rant](http://substack.net/images/substack.gif) - -This module disables a lot of infuriating things about core http that WILL cause -bugs in your application if you think of http as just another kind of stream: - -* http requests have a default idle timeout of 2 minutes. This is terrible if -you just want to pipe together a bunch of persistent backend processes over -http. - -* There is a default connection pool of 5 requests. If you have 5 or more extant -http requests, any additional requests will HANG for NO GOOD REASON. - -hyperquest turns these annoyances off so you can just pretend that core http is -just a fancier version of tcp and not the horrible monstrosity that it actually -is. - -I have it on good authority that these annoyances will be fixed in node 0.12. - -# example - -# simple streaming GET - -``` js -var hyperquest = require('hyperquest'); -hyperquest('http://localhost:8000').pipe(process.stdout); -``` - -``` -$ node example/req.js -beep boop -``` - -# pooling is evil - -Now to drive the point home about pooling being evil and almost always never -what you want ever. - -[request](https://github.com/mikeal/request) -has its own forever agent thing that works pretty much the same as node core -http.request: the wrong, horrible, broken way. - -For instance, the following request code takes 12+ seconds to finish: - -``` js -var http = require('http'); -var request = require('request'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = request('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings -``` - -``` -substack : example $ time node many_request.js -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 - -real 0m12.423s -user 0m0.424s -sys 0m0.048s -``` - -Surprising? YES. This is pretty much never what you want, particularly if you -have a lot of streaming http API endpoints. Your code will just *HANG* once the -connection pool fills up and it won't start working again until some connections -die for whatever reason. I have encountered this so many times in production -instances and it is SO hard to track down reliably. - -Compare to using hyperquest, which is exactly the same code but it takes 3 -seconds instead of 12 to finish because it's not completely self-crippled like -request and core http.request. - -``` js -var http = require('http'); -var hyperquest = require('hyperquest'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = hyperquest('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings -``` -``` -$ time node many_hyperquest.js -0 -1 -2 -3 -4 -5 -6 -8 -9 -7 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 - -real 0m3.284s -user 0m0.288s -sys 0m0.060s -``` - -So the other thing is, the justification I've heard supporting this horrible -limit-of-5 pooling behavior is "performance". The first example which has been -tuned for "performance" takes 12 seconds. The second example that removes these -"performance" enhancements takes 3. Some performance improvement INDEED! - -# methods - -``` js -var hyperquest = require('hyperquest'); -``` - -## var req = hyperquest(uri, opts={}, cb) - -Create an outgoing http request to `uri` or `opts.uri`. -You need not pass any arguments here since there are setter methods documented -below. - -Return a readable or duplex stream depending on the `opts.method`. - -Default option values: - -* opts.method - `"GET"` -* opts.headers - `{}` -* opts.auth - undefined, but is set automatically when the `uri` has an auth -string in it such as `"http://user:passwd@host"`. `opts.auth` is of the form -`"user:pass"`, just like `http.request()`. - -The request does not go through until the `nextTick` so you can set values -outside of the `opts` so long as they are called on the same tick. - -Optionally you can pass a `cb(err, res)` to set up listeners for `'error'` and -`'response'` events in one place. - -Note that the optional `cb` is NOT like -[request](https://github.com/mikeal/request) -in that hyperquest will not buffer content for you or decode to json or any such -magical thing. - -## req.setHeader(key, value); - -Set an outgoing header `key` to `value`. - -## req.setLocation(uri); - -Set the location if you didn't specify it in the `hyperquest()` call. - -## var req = hyperquest.get(uri, opts, cb) - -Return a readable stream from `hyperquest(..., { method: 'GET' })`. - -## var req = hyperquest.put(uri, opts, cb) - -Return a duplex stream from `hyperquest(..., { method: 'PUT' })`. - -## var req = hyperquest.post(uri, opts, cb) - -Return a duplex stream from `hyperquest(..., { method: 'POST' })`. - -## var req = hyperquest.delete(uri, opts, cb) - -Return a readable stream from `hyperquest(..., { method: 'DELETE' })`. - -# events - -## req.on('response', function (res) {}) - -The `'response'` event is forwarded from the underlying `http.request()`. - -## req.on('error', function (res) {}) - -The `'error'` event is forwarded from the underlying `http.request()`. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install hyperquest -``` - -# license - -MIT diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth.js deleted file mode 100644 index 6e711480..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'moo' && s[1] === 'hax') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic auth', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://moo:hax@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://beep:boop@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth_encoded.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth_encoded.js deleted file mode 100644 index bac51264..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth_encoded.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'm##' && s[1] === 'h@x') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic auth with escaped params', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://m%23%23:h%40x@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://beep:boop@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth_opt.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth_opt.js deleted file mode 100644 index f85f979e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/auth_opt.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'moo' && s[1] === 'hax') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic opts.auth', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://localhost:' + port, { auth: 'moo:hax' }); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://localhost:' + port, { auth: 'beep:boop' }); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/get.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/get.js deleted file mode 100644 index db6720d7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/get.js +++ /dev/null @@ -1,33 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.setHeader('content-type', 'text/robot-speak'); - res.end('beep boop'); -}); - -test('get', function (t) { - t.plan(2); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - r.pipe(through(write, end)); - - r.on('response', function (res) { - t.equal(res.headers['content-type'], 'text/robot-speak'); - }); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/many.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/many.js deleted file mode 100644 index 40b18b36..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/many.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.write('beep boop'); -}); - -test('more than 5 pending connections', function (t) { - t.plan(20); - var pending = []; - server.listen(0, function () { - var port = server.address().port; - for (var i = 0; i < 20; i++) { - pending.push(check(t, port)); - } - }); - t.on('end', function () { - pending.forEach(function (p) { p.destroy() }); - server.close(); - }); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.pipe(through(function (buf) { data += buf })); - - setTimeout(function () { - t.equal(data, 'beep boop'); - }, 100); - return r; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/opts.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/opts.js deleted file mode 100644 index a8b4604f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/opts.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.setHeader('content-type', 'text/robot-speak'); - res.end('beep boop'); -}); - -test('1st-arg options', function (t) { - t.plan(2); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest( - { uri: 'http://localhost:' + port }, - function (err, res) { - t.equal(res.headers['content-type'], 'text/robot-speak'); - } - ); - r.pipe(through(write, end)); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/post.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/post.js deleted file mode 100644 index fefc0643..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/post.js +++ /dev/null @@ -1,38 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - req.pipe(through(function (buf) { - this.queue(String(buf).toUpperCase()); - })).pipe(res); -}); - -test('post', function (t) { - t.plan(1); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest.post('http://localhost:' + port); - r.pipe(through(write, end)); - - setTimeout(function () { - r.write('beep '); - }, 50); - - setTimeout(function () { - r.end('boop.'); - }, 100); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'BEEP BOOP.'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/set_header.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/set_header.js deleted file mode 100644 index 6a5c59e8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/hyperquest/test/set_header.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -test('setHeader on a request', function (t) { - t.plan(2); - - var server = http.createServer(function (req, res) { - t.equal(req.headers.robot, 'party'); - res.end('beep boop'); - }); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - r.setHeader('robot', 'party'); - r.pipe(through(write, end)); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/.travis.yml deleted file mode 100644 index c693a939..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - "0.10" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/LICENSE.APACHE2 b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/LICENSE.APACHE2 deleted file mode 100644 index 6366c047..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/LICENSE.APACHE2 +++ /dev/null @@ -1,15 +0,0 @@ -Apache License, Version 2.0 - -Copyright (c) 2011 Dominic Tarr - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/LICENSE.MIT b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/LICENSE.MIT deleted file mode 100644 index 6eafbd73..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/LICENSE.MIT +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2011 Dominic Tarr - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/index.js deleted file mode 100644 index 7b935bf9..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/index.js +++ /dev/null @@ -1,108 +0,0 @@ -var Stream = require('stream') - -// through -// -// a stream that does nothing but re-emit the input. -// useful for aggregating a series of changing but not ending streams into one stream) - -exports = module.exports = through -through.through = through - -//create a readable writable stream. - -function through (write, end, opts) { - write = write || function (data) { this.queue(data) } - end = end || function () { this.queue(null) } - - var ended = false, destroyed = false, buffer = [], _ended = false - var stream = new Stream() - stream.readable = stream.writable = true - stream.paused = false - -// stream.autoPause = !(opts && opts.autoPause === false) - stream.autoDestroy = !(opts && opts.autoDestroy === false) - - stream.write = function (data) { - write.call(this, data) - return !stream.paused - } - - function drain() { - while(buffer.length && !stream.paused) { - var data = buffer.shift() - if(null === data) - return stream.emit('end') - else - stream.emit('data', data) - } - } - - stream.queue = stream.push = function (data) { -// console.error(ended) - if(_ended) return stream - if(data == null) _ended = true - buffer.push(data) - drain() - return stream - } - - //this will be registered as the first 'end' listener - //must call destroy next tick, to make sure we're after any - //stream piped from here. - //this is only a problem if end is not emitted synchronously. - //a nicer way to do this is to make sure this is the last listener for 'end' - - stream.on('end', function () { - stream.readable = false - if(!stream.writable && stream.autoDestroy) - process.nextTick(function () { - stream.destroy() - }) - }) - - function _end () { - stream.writable = false - end.call(stream) - if(!stream.readable && stream.autoDestroy) - stream.destroy() - } - - stream.end = function (data) { - if(ended) return - ended = true - if(arguments.length) stream.write(data) - _end() // will emit or queue - return stream - } - - stream.destroy = function () { - if(destroyed) return - destroyed = true - ended = true - buffer.length = 0 - stream.writable = stream.readable = false - stream.emit('close') - return stream - } - - stream.pause = function () { - if(stream.paused) return - stream.paused = true - return stream - } - - stream.resume = function () { - if(stream.paused) { - stream.paused = false - stream.emit('resume') - } - drain() - //may have become paused again, - //as drain emits 'data'. - if(!stream.paused) - stream.emit('drain') - return stream - } - return stream -} - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/package.json deleted file mode 100644 index 65301c5a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "through", - "version": "2.3.4", - "description": "simplified stream contsruction", - "main": "index.js", - "scripts": { - "test": "set -e; for t in test/*.js; do node $t; done" - }, - "devDependencies": { - "stream-spec": "~0.3.5", - "tape": "~0.2.2" - }, - "keywords": [ - "stream", - "streams", - "user-streams", - "pipe" - ], - "author": { - "name": "Dominic Tarr", - "email": "dominic.tarr@gmail.com", - "url": "dominictarr.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/dominictarr/through.git" - }, - "homepage": "http://github.com/dominictarr/through", - "testling": { - "browsers": [ - "ie/8..latest", - "ff/15..latest", - "chrome/20..latest", - "safari/5.1..latest" - ], - "files": "test/*.js" - }, - "readme": "#through\n\n[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through)\n\nEasy way to create a `Stream` that is both `readable` and `writable`. \n\n* Pass in optional `write` and `end` methods.\n* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.\n* Use `this.pause()` and `this.resume()` to manage flow.\n* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`).\n\nThis function is the basis for most of the synchronous streams in \n[event-stream](http://github.com/dominictarr/event-stream).\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.queue(data) //data *must* not be null\n },\n function end () { //optional\n this.queue(null)\n })\n```\n\nOr, can also be used _without_ buffering on pause, use `this.emit('data', data)`,\nand this.emit('end')\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.emit('data', data)\n //this.pause() \n },\n function end () { //optional\n this.emit('end')\n })\n```\n\n## Extended Options\n\nYou will probably not need these 99% of the time.\n\n### autoDestroy=false\n\nBy default, `through` emits close when the writable\nand readable side of the stream has ended.\nIf that is not desired, set `autoDestroy=false`.\n\n``` js\nvar through = require('through')\n\n//like this\nvar ts = through(write, end, {autoDestroy: false})\n//or like this\nvar ts = through(write, end)\nts.autoDestroy = false\n```\n\n## License\n\nMIT / Apache2\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/dominictarr/through/issues" - }, - "_id": "through@2.3.4", - "_from": "through@~2.3.4" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/readme.markdown b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/readme.markdown deleted file mode 100644 index b20bc9a8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/readme.markdown +++ /dev/null @@ -1,63 +0,0 @@ -#through - -[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through) - -Easy way to create a `Stream` that is both `readable` and `writable`. - -* Pass in optional `write` and `end` methods. -* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`. -* Use `this.pause()` and `this.resume()` to manage flow. -* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`). - -This function is the basis for most of the synchronous streams in -[event-stream](http://github.com/dominictarr/event-stream). - -``` js -var through = require('through') - -through(function write(data) { - this.queue(data) //data *must* not be null - }, - function end () { //optional - this.queue(null) - }) -``` - -Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`, -and this.emit('end') - -``` js -var through = require('through') - -through(function write(data) { - this.emit('data', data) - //this.pause() - }, - function end () { //optional - this.emit('end') - }) -``` - -## Extended Options - -You will probably not need these 99% of the time. - -### autoDestroy=false - -By default, `through` emits close when the writable -and readable side of the stream has ended. -If that is not desired, set `autoDestroy=false`. - -``` js -var through = require('through') - -//like this -var ts = through(write, end, {autoDestroy: false}) -//or like this -var ts = through(write, end) -ts.autoDestroy = false -``` - -## License - -MIT / Apache2 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/auto-destroy.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/auto-destroy.js deleted file mode 100644 index 9a8fd000..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/auto-destroy.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - ts.autoDestroy = false - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.notOk(closed) - ts.destroy() - assert.ok(closed) - assert.end() -}) - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/buffering.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/buffering.js deleted file mode 100644 index b0084bfc..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/buffering.js +++ /dev/null @@ -1,71 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('buffering', function(assert) { - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - assert.deepEqual(actual, [1, 2, 3]) - ts.pause() - ts.write(4) - ts.write(5) - ts.write(6) - assert.deepEqual(actual, [1, 2, 3]) - ts.resume() - assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) - ts.pause() - ts.end() - assert.ok(!ended) - ts.resume() - assert.ok(ended) - assert.end() -}) - -test('buffering has data in queue, when ends', function (assert) { - - /* - * If stream ends while paused with data in the queue, - * stream should still emit end after all data is written - * on resume. - */ - - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.pause() - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.deepEqual(actual, [], 'no data written yet, still paused') - assert.ok(!ended, 'end not emitted yet, still paused') - ts.resume() - assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') - assert.ok(ended, 'end should be emitted once all data was delivered') - assert.end(); -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/end.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/end.js deleted file mode 100644 index fa113f58..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/end.js +++ /dev/null @@ -1,45 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.ok(closed) - assert.end() -}) - -test('end only once', function (t) { - - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - t.equal(ended, false) - ended = true - }) - - ts.queue(null) - ts.queue(null) - ts.queue(null) - - ts.resume() - - t.end() -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/index.js deleted file mode 100644 index 33e33f96..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/node_modules/through/test/index.js +++ /dev/null @@ -1,114 +0,0 @@ - -var test = require('tape') -var spec = require('stream-spec') -var through = require('../') - -/* - I'm using these two functions, and not streams and pipe - so there is less to break. if this test fails it must be - the implementation of _through_ -*/ - -function write(array, stream) { - array = array.slice() - function next() { - while(array.length) - if(stream.write(array.shift()) === false) - return stream.once('drain', next) - - stream.end() - } - - next() -} - -function read(stream, callback) { - var actual = [] - stream.on('data', function (data) { - actual.push(data) - }) - stream.once('end', function () { - callback(null, actual) - }) - stream.once('error', function (err) { - callback(err) - }) -} - -test('simple defaults', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through() - spec(t) - .through() - .pausable() - .validateOnExit() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - write(expected, t) -}); - -test('simple functions', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through(function (data) { - this.emit('data', data*2) - }) - spec(t) - .through() - .pausable() - .validateOnExit() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected.map(function (data) { - return data*2 - })) - assert.end() - }) - - write(expected, t) -}) - -test('pauses', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l) //Math.random()) - - var t = through() - spec(t) - .through() - .pausable() - .validateOnExit() - - t.on('data', function () { - if(Math.random() > 0.1) return - t.pause() - process.nextTick(function () { - t.resume() - }) - }) - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - write(expected, t) -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/package.json deleted file mode 100644 index 9632020a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperdirect/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "hyperdirect", - "version": "0.0.0", - "description": "Follow redirects for hyperquest GET requests", - "main": "index.js", - "scripts": { - "test": "mocha -R spec" - }, - "repository": { - "type": "git", - "url": "https://github.com/ForbesLindesay/hyperdirect.git" - }, - "author": { - "name": "ForbesLindesay" - }, - "license": "MIT", - "dependencies": { - "through": "~2.3.4", - "hyperquest": "~0.1.5" - }, - "readme": "# hyperdirect\r\n\r\nFollow redirects for hyperquest GET requests. Process all other requests exactly as normal.\r\n\r\n## Installation\r\n\r\n $ npm install hyperdirect\r\n\r\n## Usage\r\n\r\n```js\r\n//basic usage\r\nvar request = require('hyperquest').request;\r\n\r\nrequest('https://github.com/ForbesLindesay/hyperdirect/archive/master.tar.gz')\r\n .pipe(require('fs').createWriteStream(__dirname + '/hyperdirect.tar.gz'));\r\n\r\n//moderate usage\r\nvar request = require('hyperquest')(2/* Max Redirects to follow, defaults to 10 */);\r\n\r\nrequest('https://github.com/ForbesLindesay/hyperdirect/archive/master.tar.gz')\r\n .pipe(require('fs').createWriteStream(__dirname + '/hyperdirect.tar.gz'));\r\n\r\n//advanced usage\r\nvar hyperdirect = require('hyperdirect')(5, require('hyperquest'));\r\n```\r\n\r\n## API\r\n\r\n### hyperdirect(maxRedirects, subquest)\r\n\r\nReturns a new function with the same API as [hyperquest](https://github.com/hyperquest/hyperquest) but which follows redirects for GET requests. Both `maxRedirects` and `subquest` are optional and can be in either order.\r\n\r\nIf provided, `subquest` should be a function which matches the API of [hyperquest](https://github.com/hyperquest/hyperquest) or an object of the form `{request: hyperquest}` where `hyperquest` is a function matching the API of [hyperquest](https://github.com/hyperquest/hyperquest).\r\n\r\n`maxRedirects` will default to `10`. Once the request has been redirected more times than that it will give up and throw an error. The error has a `res` and `statusCode` property set to the apropriate properties from the last request made.\r\n\r\nThe returned stream will emit `redirect` events with the response of any request that results in another redirect. This means you could trace the path something a request took by doing:\r\n\r\n```js\r\nrequire('hyperdirect')(100)(url)\r\n .on('redirect', function (res) {\r\n console.log('REDIRECT ' + res.statusCode + ': ' + res.headers.location);\r\n })\r\n .on('response', function (res) {\r\n console.log('FINAL URL: ' + res.url);\r\n });\r\n```\r\n\r\n### hyperdirect.request(uri, opts, cb)\r\n\r\nFollows exactly the same API as [hyperquest](https://github.com/hyperquest/hyperquest) but automatically follows up to 10 redirects for GET requests. It's the same as what you get by calling `hyperdirect()`.\r\n\r\n## License\r\n\r\nMIT", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/ForbesLindesay/hyperdirect/issues" - }, - "homepage": "https://github.com/ForbesLindesay/hyperdirect", - "_id": "hyperdirect@0.0.0", - "dist": { - "shasum": "4024d59ba71442d340c1cf649ce7e42209840c3d" - }, - "_from": "hyperdirect@", - "_resolved": "https://registry.npmjs.org/hyperdirect/-/hyperdirect-0.0.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/.travis.yml deleted file mode 100644 index dad2273c..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.8 - - "0.10" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/LICENSE deleted file mode 100644 index ee27ba4b..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/many_hyperquest.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/many_hyperquest.js deleted file mode 100644 index 590e3bd5..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/many_hyperquest.js +++ /dev/null @@ -1,20 +0,0 @@ -var http = require('http'); -var hyperquest = require('../'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = hyperquest('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/many_request.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/many_request.js deleted file mode 100644 index abbc28ea..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/many_request.js +++ /dev/null @@ -1,20 +0,0 @@ -var http = require('http'); -var request = require('request'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = request('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/req.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/req.js deleted file mode 100644 index 2d73de7e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/example/req.js +++ /dev/null @@ -1,2 +0,0 @@ -var hyperquest = require('../'); -hyperquest('http://localhost:8000').pipe(process.stdout); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/index.js deleted file mode 100644 index b487c87f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/index.js +++ /dev/null @@ -1,151 +0,0 @@ -var url = require('url'); -var http = require('http'); -var https = require('https'); -var through = require('through'); -var duplexer = require('duplexer'); - -module.exports = hyperquest; - -function bind (obj, fn) { - var args = Array.prototype.slice.call(arguments, 2); - return function () { - var argv = args.concat(Array.prototype.slice.call(arguments)); - return fn.apply(obj, argv); - } -} - -function hyperquest (uri, opts, cb, extra) { - if (typeof uri === 'object') { - cb = opts; - opts = uri; - uri = undefined; - } - if (typeof opts === 'function') { - cb = opts; - opts = undefined; - } - if (!opts) opts = {}; - if (uri !== undefined) opts.uri = uri; - if (extra) opts.method = extra.method; - - var req = new Req(opts); - var ws = req.duplex && through(); - if (ws) ws.pause(); - var rs = through(); - - var dup = req.duplex ? duplexer(ws, rs) : rs; - if (!req.duplex) { - rs.writable = false; - } - dup.request = req; - dup.setHeader = bind(req, req.setHeader); - dup.setLocation = bind(req, req.setLocation); - - var closed = false; - dup.on('close', function () { closed = true }); - - process.nextTick(function () { - if (closed) return; - dup.on('close', function () { r.destroy() }); - - var r = req._send(); - r.on('error', bind(dup, dup.emit, 'error')); - - r.on('response', function (res) { - dup.response = res; - dup.emit('response', res); - if (req.duplex) res.pipe(rs) - else { - res.on('data', function (buf) { rs.queue(buf) }); - res.on('end', function () { rs.queue(null) }); - } - }); - - if (req.duplex) { - ws.pipe(r); - ws.resume(); - } - else r.end(); - }); - - if (cb) { - dup.on('error', cb); - dup.on('response', bind(dup, cb, null)); - } - return dup; -} - -hyperquest.get = hyperquest; - -hyperquest.post = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'POST' }); -}; - -hyperquest.put = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'PUT' }); -}; - -hyperquest['delete'] = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'DELETE' }); -}; - -function Req (opts) { - this.headers = opts.headers || {}; - - var method = (opts.method || 'GET').toUpperCase(); - this.method = method; - this.duplex = !(method === 'GET' || method === 'DELETE' - || method === 'HEAD'); - this.auth = opts.auth; - - this.options = opts; - - if (opts.uri) this.setLocation(opts.uri); -} - -Req.prototype._send = function () { - this._sent = true; - - var headers = this.headers || {}; - var u = url.parse(this.uri); - var au = u.auth || this.auth; - if (au) { - headers.authorization = 'Basic ' + Buffer(au).toString('base64'); - } - - var protocol = u.protocol || ''; - var iface = protocol === 'https:' ? https : http; - var opts = { - scheme: protocol.replace(/:$/, ''), - method: this.method, - host: u.hostname, - port: Number(u.port) || (protocol === 'https:' ? 443 : 80), - path: u.path, - agent: false, - headers: headers - }; - if (protocol === 'https:') { - opts.pfx = this.options.pfx; - opts.key = this.options.key; - opts.cert = this.options.cert; - opts.ca = this.options.ca; - opts.ciphers = this.options.ciphers; - opts.rejectUnauthorized = this.options.rejectUnauthorized; - opts.secureProtocol = this.options.secureProtocol; - } - var req = iface.request(opts); - - if (req.setTimeout) req.setTimeout(Math.pow(2, 32) * 1000); - return req; -}; - -Req.prototype.setHeader = function (key, value) { - if (this._sent) throw new Error('request already sent'); - this.headers[key] = value; - return this; -}; - -Req.prototype.setLocation = function (uri) { - this.uri = uri; - return this; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/.npmignore deleted file mode 100644 index 062c11e8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -*.log -*.err \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/.travis.yml deleted file mode 100644 index ed05f88d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.11" - - "0.10" - - "0.8" - - "0.6" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/LICENCE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/LICENCE deleted file mode 100644 index a23e08a8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Raynos. - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/README.md deleted file mode 100644 index 61ff71aa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# duplexer - -[![build status][1]][2] [![dependency status][3]][4] - -[![browser support][5]][6] - -Creates a duplex stream - -Taken from [event-stream][7] - -## duplex (writeStream, readStream) - -Takes a writable stream and a readable stream and makes them appear as a readable writable stream. - -It is assumed that the two streams are connected to each other in some way. - -## Example - -```js -var grep = cp.exec('grep Stream') - -duplex(grep.stdin, grep.stdout) -``` - -## Installation - -`npm install duplexer` - -## Tests - -`npm test` - -## Contributors - - - Dominictarr - - Raynos - - samccone - -## MIT Licenced - - [1]: https://secure.travis-ci.org/Raynos/duplexer.png - [2]: https://travis-ci.org/Raynos/duplexer - [3]: https://david-dm.org/Raynos/duplexer.png - [4]: https://david-dm.org/Raynos/duplexer - [5]: https://ci.testling.com/Raynos/duplexer.png - [6]: https://ci.testling.com/Raynos/duplexer - [7]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/index.js deleted file mode 100644 index a188a210..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/index.js +++ /dev/null @@ -1,87 +0,0 @@ -var Stream = require("stream") -var writeMethods = ["write", "end", "destroy"] -var readMethods = ["resume", "pause"] -var readEvents = ["data", "close"] -var slice = Array.prototype.slice - -module.exports = duplex - -function forEach (arr, fn) { - if (arr.forEach) { - return arr.forEach(fn) - } - - for (var i = 0; i < arr.length; i++) { - fn(arr[i], i) - } -} - -function duplex(writer, reader) { - var stream = new Stream() - var ended = false - - forEach(writeMethods, proxyWriter) - - forEach(readMethods, proxyReader) - - forEach(readEvents, proxyStream) - - reader.on("end", handleEnd) - - writer.on("drain", function() { - stream.emit("drain") - }) - - writer.on("error", reemit) - reader.on("error", reemit) - - stream.writable = writer.writable - stream.readable = reader.readable - - return stream - - function proxyWriter(methodName) { - stream[methodName] = method - - function method() { - return writer[methodName].apply(writer, arguments) - } - } - - function proxyReader(methodName) { - stream[methodName] = method - - function method() { - stream.emit(methodName) - var func = reader[methodName] - if (func) { - return func.apply(reader, arguments) - } - reader.emit(methodName) - } - } - - function proxyStream(methodName) { - reader.on(methodName, reemit) - - function reemit() { - var args = slice.call(arguments) - args.unshift(methodName) - stream.emit.apply(stream, args) - } - } - - function handleEnd() { - if (ended) { - return - } - ended = true - var args = slice.call(arguments) - args.unshift("end") - stream.emit.apply(stream, args) - } - - function reemit(err) { - stream.emit("error", err) - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/package.json deleted file mode 100644 index f6f719c2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "duplexer", - "version": "0.1.1", - "description": "Creates a duplex stream", - "keywords": [], - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/Raynos/duplexer.git" - }, - "main": "index", - "homepage": "https://github.com/Raynos/duplexer", - "contributors": [ - { - "name": "Jake Verbaten" - } - ], - "bugs": { - "url": "https://github.com/Raynos/duplexer/issues", - "email": "raynos2@gmail.com" - }, - "devDependencies": { - "tape": "0.3.3", - "through": "~0.1.4" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Raynos/duplexer/raw/master/LICENSE" - } - ], - "scripts": { - "test": "node test" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest" - ] - }, - "readme": "# duplexer\n\n[![build status][1]][2] [![dependency status][3]][4]\n\n[![browser support][5]][6]\n\nCreates a duplex stream\n\nTaken from [event-stream][7]\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way.\n\n## Example\n\n```js\nvar grep = cp.exec('grep Stream')\n\nduplex(grep.stdin, grep.stdout)\n```\n\n## Installation\n\n`npm install duplexer`\n\n## Tests\n\n`npm test`\n\n## Contributors\n\n - Dominictarr\n - Raynos\n - samccone\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/duplexer.png\n [2]: https://travis-ci.org/Raynos/duplexer\n [3]: https://david-dm.org/Raynos/duplexer.png\n [4]: https://david-dm.org/Raynos/duplexer\n [5]: https://ci.testling.com/Raynos/duplexer.png\n [6]: https://ci.testling.com/Raynos/duplexer\n [7]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream\n", - "readmeFilename": "README.md", - "_id": "duplexer@0.1.1", - "_from": "duplexer@~0.1.0" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/test/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/test/index.js deleted file mode 100644 index 4988e0d9..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/duplexer/test/index.js +++ /dev/null @@ -1,31 +0,0 @@ -var through = require("through") -var test = require("tape") - -var duplex = require("../index") - -var readable = through() -var writable = through(write) -var written = 0 -var data = 0 - -var stream = duplex(writable, readable) - -function write() { - written++ -} - -stream.on("data", ondata) - -function ondata() { - data++ -} - -test("emit and write", function(t) { - t.plan(2) - - stream.write() - readable.emit("data") - - t.equal(written, 1, "should have written once") - t.equal(data, 1, "should have recived once") -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/.travis.yml deleted file mode 100644 index 895dbd36..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/LICENSE.APACHE2 b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/LICENSE.APACHE2 deleted file mode 100644 index 6366c047..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/LICENSE.APACHE2 +++ /dev/null @@ -1,15 +0,0 @@ -Apache License, Version 2.0 - -Copyright (c) 2011 Dominic Tarr - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/LICENSE.MIT b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/LICENSE.MIT deleted file mode 100644 index 6eafbd73..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/LICENSE.MIT +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2011 Dominic Tarr - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/index.js deleted file mode 100644 index d9165607..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/index.js +++ /dev/null @@ -1,103 +0,0 @@ -var Stream = require('stream') - -// through -// -// a stream that does nothing but re-emit the input. -// useful for aggregating a series of changing but not ending streams into one stream) - - - -exports = module.exports = through -through.through = through - -//create a readable writable stream. - -function through (write, end) { - write = write || function (data) { this.queue(data) } - end = end || function () { this.queue(null) } - - var ended = false, destroyed = false, buffer = [] - var stream = new Stream() - stream.readable = stream.writable = true - stream.paused = false - - stream.write = function (data) { - write.call(this, data) - return !stream.paused - } - - function drain() { - while(buffer.length && !stream.paused) { - var data = buffer.shift() - if(null === data) - return stream.emit('end') - else - stream.emit('data', data) - } - } - - stream.queue = stream.push = function (data) { - buffer.push(data) - drain() - return stream - } - - //this will be registered as the first 'end' listener - //must call destroy next tick, to make sure we're after any - //stream piped from here. - //this is only a problem if end is not emitted synchronously. - //a nicer way to do this is to make sure this is the last listener for 'end' - - stream.on('end', function () { - stream.readable = false - if(!stream.writable) - process.nextTick(function () { - stream.destroy() - }) - }) - - function _end () { - stream.writable = false - end.call(stream) - if(!stream.readable) - stream.destroy() - } - - stream.end = function (data) { - if(ended) return - ended = true - if(arguments.length) stream.write(data) - _end() // will emit or queue - return stream - } - - stream.destroy = function () { - if(destroyed) return - destroyed = true - ended = true - buffer.length = 0 - stream.writable = stream.readable = false - stream.emit('close') - return stream - } - - stream.pause = function () { - if(stream.paused) return - stream.paused = true - stream.emit('pause') - return stream - } - stream.resume = function () { - if(stream.paused) { - stream.paused = false - } - drain() - //may have become paused again, - //as drain emits 'data'. - if(!stream.paused) - stream.emit('drain') - return stream - } - return stream -} - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/package.json deleted file mode 100644 index 350964b3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "through", - "version": "2.2.7", - "description": "simplified stream contruction", - "main": "index.js", - "scripts": { - "test": "set -e; for t in test/*.js; do node $t; done" - }, - "devDependencies": { - "stream-spec": "~0.3.5", - "tape": "~0.2.2" - }, - "keywords": [ - "stream", - "streams", - "user-streams", - "pipe" - ], - "author": { - "name": "Dominic Tarr", - "email": "dominic.tarr@gmail.com", - "url": "dominictarr.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/dominictarr/through.git" - }, - "homepage": "http://github.com/dominictarr/through", - "testling": { - "browsers": [ - "ie/8..latest", - "ff/15..latest", - "chrome/20..latest", - "safari/5.1..latest" - ], - "files": "test/*.js" - }, - "readme": "#through\n\n[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through)\n\nEasy way to create a `Stream` that is both `readable` and `writable`. \n\n* Pass in optional `write` and `end` methods.\n* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.\n* Use `this.pause()` and `this.resume()` to manage flow.\n* Check `this.paused` to see current flow state. (write always returns `!this.paused`).\n\nThis function is the basis for most of the synchronous streams in \n[event-stream](http://github.com/dominictarr/event-stream).\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.queue(data) //data *must* not be null\n },\n function end () { //optional\n this.queue(null)\n })\n```\n\nOr, can also be used _without_ buffering on pause, use `this.emit('data', data)`,\nand this.emit('end')\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.emit('data', data)\n //this.pause() \n },\n function end () { //optional\n this.emit('end')\n })\n```\n\n## License\n\nMIT / Apache2\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/dominictarr/through/issues" - }, - "_id": "through@2.2.7", - "_from": "through@~2.2.0" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/readme.markdown b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/readme.markdown deleted file mode 100644 index 870fdd1d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/readme.markdown +++ /dev/null @@ -1,43 +0,0 @@ -#through - -[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through) - -Easy way to create a `Stream` that is both `readable` and `writable`. - -* Pass in optional `write` and `end` methods. -* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`. -* Use `this.pause()` and `this.resume()` to manage flow. -* Check `this.paused` to see current flow state. (write always returns `!this.paused`). - -This function is the basis for most of the synchronous streams in -[event-stream](http://github.com/dominictarr/event-stream). - -``` js -var through = require('through') - -through(function write(data) { - this.queue(data) //data *must* not be null - }, - function end () { //optional - this.queue(null) - }) -``` - -Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`, -and this.emit('end') - -``` js -var through = require('through') - -through(function write(data) { - this.emit('data', data) - //this.pause() - }, - function end () { //optional - this.emit('end') - }) -``` - -## License - -MIT / Apache2 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/buffering.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/buffering.js deleted file mode 100644 index b0084bfc..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/buffering.js +++ /dev/null @@ -1,71 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('buffering', function(assert) { - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - assert.deepEqual(actual, [1, 2, 3]) - ts.pause() - ts.write(4) - ts.write(5) - ts.write(6) - assert.deepEqual(actual, [1, 2, 3]) - ts.resume() - assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) - ts.pause() - ts.end() - assert.ok(!ended) - ts.resume() - assert.ok(ended) - assert.end() -}) - -test('buffering has data in queue, when ends', function (assert) { - - /* - * If stream ends while paused with data in the queue, - * stream should still emit end after all data is written - * on resume. - */ - - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.pause() - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.deepEqual(actual, [], 'no data written yet, still paused') - assert.ok(!ended, 'end not emitted yet, still paused') - ts.resume() - assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') - assert.ok(ended, 'end should be emitted once all data was delivered') - assert.end(); -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/end.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/end.js deleted file mode 100644 index 73216676..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/end.js +++ /dev/null @@ -1,26 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.ok(closed) - assert.end() -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/index.js deleted file mode 100644 index 33e33f96..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/node_modules/through/test/index.js +++ /dev/null @@ -1,114 +0,0 @@ - -var test = require('tape') -var spec = require('stream-spec') -var through = require('../') - -/* - I'm using these two functions, and not streams and pipe - so there is less to break. if this test fails it must be - the implementation of _through_ -*/ - -function write(array, stream) { - array = array.slice() - function next() { - while(array.length) - if(stream.write(array.shift()) === false) - return stream.once('drain', next) - - stream.end() - } - - next() -} - -function read(stream, callback) { - var actual = [] - stream.on('data', function (data) { - actual.push(data) - }) - stream.once('end', function () { - callback(null, actual) - }) - stream.once('error', function (err) { - callback(err) - }) -} - -test('simple defaults', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through() - spec(t) - .through() - .pausable() - .validateOnExit() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - write(expected, t) -}); - -test('simple functions', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through(function (data) { - this.emit('data', data*2) - }) - spec(t) - .through() - .pausable() - .validateOnExit() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected.map(function (data) { - return data*2 - })) - assert.end() - }) - - write(expected, t) -}) - -test('pauses', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l) //Math.random()) - - var t = through() - spec(t) - .through() - .pausable() - .validateOnExit() - - t.on('data', function () { - if(Math.random() > 0.1) return - t.pause() - process.nextTick(function () { - t.resume() - }) - }) - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - write(expected, t) -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/package.json deleted file mode 100644 index 56f70772..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "hyperquest", - "version": "0.2.0", - "description": "make streaming http requests", - "main": "index.js", - "dependencies": { - "through": "~2.2.0", - "duplexer": "~0.1.0" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "scripts": { - "test": "tap test/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/substack/hyperquest.git" - }, - "homepage": "https://github.com/substack/hyperquest", - "keywords": [ - "stream", - "http", - "transport", - "request", - "get", - "post", - "put", - "delete", - "duplex", - "pooling" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "license": "MIT", - "readme": "# hyperquest\n\ntreat http requests as a streaming transport\n\n[![build status](https://secure.travis-ci.org/substack/hyperquest.png)](http://travis-ci.org/substack/hyperquest)\n\nThe hyperquest api is a subset of [request](https://github.com/mikeal/request).\n\nThis module works in the browser with [browserify](http://browserify.org).\n\n# rant\n\n![animated gif rant](http://substack.net/images/substack.gif)\n\nThis module disables a lot of infuriating things about core http that WILL cause\nbugs in your application if you think of http as just another kind of stream:\n\n* http requests have a default idle timeout of 2 minutes. This is terrible if\nyou just want to pipe together a bunch of persistent backend processes over\nhttp.\n\n* There is a default connection pool of 5 requests. If you have 5 or more extant\nhttp requests, any additional requests will HANG for NO GOOD REASON.\n\nhyperquest turns these annoyances off so you can just pretend that core http is\njust a fancier version of tcp and not the horrible monstrosity that it actually\nis.\n\nI have it on good authority that these annoyances will be fixed in node 0.12.\n\n# example\n\n# simple streaming GET\n\n``` js\nvar hyperquest = require('hyperquest');\nhyperquest('http://localhost:8000').pipe(process.stdout);\n```\n\n```\n$ node example/req.js\nbeep boop\n```\n\n# pooling is evil\n\nNow to drive the point home about pooling being evil and almost always never\nwhat you want ever.\n\n[request](https://github.com/mikeal/request)\nhas its own forever agent thing that works pretty much the same as node core\nhttp.request: the wrong, horrible, broken way.\n\nFor instance, the following request code takes 12+ seconds to finish:\n\n``` js\nvar http = require('http');\nvar request = require('request');\n\nvar server = http.createServer(function (req, res) {\n res.write(req.url.slice(1) + '\\n');\n setTimeout(res.end.bind(res), 3000);\n});\n\nserver.listen(5000, function () {\n var pending = 20;\n for (var i = 0; i < 20; i++) {\n var r = request('http://localhost:5000/' + i);\n r.pipe(process.stdout, { end: false });\n r.on('end', function () {\n if (--pending === 0) server.close();\n });\n }\n});\n\nprocess.stdout.setMaxListeners(0); // turn off annoying warnings\n```\n\n```\nsubstack : example $ time node many_request.js \n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\nreal 0m12.423s\nuser 0m0.424s\nsys 0m0.048s\n```\n\nSurprising? YES. This is pretty much never what you want, particularly if you\nhave a lot of streaming http API endpoints. Your code will just *HANG* once the\nconnection pool fills up and it won't start working again until some connections\ndie for whatever reason. I have encountered this so many times in production\ninstances and it is SO hard to track down reliably.\n\nCompare to using hyperquest, which is exactly the same code but it takes 3\nseconds instead of 12 to finish because it's not completely self-crippled like\nrequest and core http.request.\n\n``` js\nvar http = require('http');\nvar hyperquest = require('hyperquest');\n\nvar server = http.createServer(function (req, res) {\n res.write(req.url.slice(1) + '\\n');\n setTimeout(res.end.bind(res), 3000);\n});\n\nserver.listen(5000, function () {\n var pending = 20;\n for (var i = 0; i < 20; i++) {\n var r = hyperquest('http://localhost:5000/' + i);\n r.pipe(process.stdout, { end: false });\n r.on('end', function () {\n if (--pending === 0) server.close();\n });\n }\n});\n\nprocess.stdout.setMaxListeners(0); // turn off annoying warnings\n```\n```\n$ time node many_hyperquest.js \n0\n1\n2\n3\n4\n5\n6\n8\n9\n7\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\nreal 0m3.284s\nuser 0m0.288s\nsys 0m0.060s\n```\n\nSo the other thing is, the justification I've heard supporting this horrible\nlimit-of-5 pooling behavior is \"performance\". The first example which has been\ntuned for \"performance\" takes 12 seconds. The second example that removes these\n\"performance\" enhancements takes 3. Some performance improvement INDEED!\n\n# methods\n\n``` js\nvar hyperquest = require('hyperquest');\n```\n\n## var req = hyperquest(uri, opts={}, cb)\n\nCreate an outgoing http request to `uri` or `opts.uri`.\nYou need not pass any arguments here since there are setter methods documented\nbelow.\n\nReturn a readable or duplex stream depending on the `opts.method`.\n\nDefault option values:\n\n* opts.method - `\"GET\"`\n* opts.headers - `{}`\n* opts.auth - undefined, but is set automatically when the `uri` has an auth\nstring in it such as `\"http://user:passwd@host\"`. `opts.auth` is of the form\n`\"user:pass\"`, just like `http.request()`.\n\nIn https mode, you can specify options to the underlying `tls.connect()` call:\n\n* opts.pfx\n* opts.key\n* opts.cert\n* opts.ca\n* opts.ciphers\n* opts.rejectUnauthorized\n* opts.secureProtocol\n\nThe request does not go through until the `nextTick` so you can set values\noutside of the `opts` so long as they are called on the same tick.\n\nOptionally you can pass a `cb(err, res)` to set up listeners for `'error'` and\n`'response'` events in one place.\n\nNote that the optional `cb` is NOT like\n[request](https://github.com/mikeal/request)\nin that hyperquest will not buffer content for you or decode to json or any such\nmagical thing.\n\n## req.setHeader(key, value);\n\nSet an outgoing header `key` to `value`.\n\n## req.setLocation(uri);\n\nSet the location if you didn't specify it in the `hyperquest()` call.\n\n## var req = hyperquest.get(uri, opts, cb)\n\nReturn a readable stream from `hyperquest(..., { method: 'GET' })`.\n\n## var req = hyperquest.put(uri, opts, cb)\n\nReturn a duplex stream from `hyperquest(..., { method: 'PUT' })`.\n\n## var req = hyperquest.post(uri, opts, cb)\n\nReturn a duplex stream from `hyperquest(..., { method: 'POST' })`.\n\n## var req = hyperquest.delete(uri, opts, cb)\n\nReturn a readable stream from `hyperquest(..., { method: 'DELETE' })`.\n\n# events\n\n## req.on('response', function (res) {})\n\nThe `'response'` event is forwarded from the underlying `http.request()`.\n\n## req.on('error', function (res) {})\n\nThe `'error'` event is forwarded from the underlying `http.request()`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install hyperquest\n```\n\n# license\n\nMIT\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/substack/hyperquest/issues" - }, - "_id": "hyperquest@0.2.0", - "dist": { - "shasum": "4d3e59af6604e8ccab73f76896d5844495fa85aa" - }, - "_from": "hyperquest@", - "_resolved": "https://registry.npmjs.org/hyperquest/-/hyperquest-0.2.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/readme.markdown b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/readme.markdown deleted file mode 100644 index abb99ba3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/readme.markdown +++ /dev/null @@ -1,259 +0,0 @@ -# hyperquest - -treat http requests as a streaming transport - -[![build status](https://secure.travis-ci.org/substack/hyperquest.png)](http://travis-ci.org/substack/hyperquest) - -The hyperquest api is a subset of [request](https://github.com/mikeal/request). - -This module works in the browser with [browserify](http://browserify.org). - -# rant - -![animated gif rant](http://substack.net/images/substack.gif) - -This module disables a lot of infuriating things about core http that WILL cause -bugs in your application if you think of http as just another kind of stream: - -* http requests have a default idle timeout of 2 minutes. This is terrible if -you just want to pipe together a bunch of persistent backend processes over -http. - -* There is a default connection pool of 5 requests. If you have 5 or more extant -http requests, any additional requests will HANG for NO GOOD REASON. - -hyperquest turns these annoyances off so you can just pretend that core http is -just a fancier version of tcp and not the horrible monstrosity that it actually -is. - -I have it on good authority that these annoyances will be fixed in node 0.12. - -# example - -# simple streaming GET - -``` js -var hyperquest = require('hyperquest'); -hyperquest('http://localhost:8000').pipe(process.stdout); -``` - -``` -$ node example/req.js -beep boop -``` - -# pooling is evil - -Now to drive the point home about pooling being evil and almost always never -what you want ever. - -[request](https://github.com/mikeal/request) -has its own forever agent thing that works pretty much the same as node core -http.request: the wrong, horrible, broken way. - -For instance, the following request code takes 12+ seconds to finish: - -``` js -var http = require('http'); -var request = require('request'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = request('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings -``` - -``` -substack : example $ time node many_request.js -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 - -real 0m12.423s -user 0m0.424s -sys 0m0.048s -``` - -Surprising? YES. This is pretty much never what you want, particularly if you -have a lot of streaming http API endpoints. Your code will just *HANG* once the -connection pool fills up and it won't start working again until some connections -die for whatever reason. I have encountered this so many times in production -instances and it is SO hard to track down reliably. - -Compare to using hyperquest, which is exactly the same code but it takes 3 -seconds instead of 12 to finish because it's not completely self-crippled like -request and core http.request. - -``` js -var http = require('http'); -var hyperquest = require('hyperquest'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = hyperquest('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings -``` -``` -$ time node many_hyperquest.js -0 -1 -2 -3 -4 -5 -6 -8 -9 -7 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 - -real 0m3.284s -user 0m0.288s -sys 0m0.060s -``` - -So the other thing is, the justification I've heard supporting this horrible -limit-of-5 pooling behavior is "performance". The first example which has been -tuned for "performance" takes 12 seconds. The second example that removes these -"performance" enhancements takes 3. Some performance improvement INDEED! - -# methods - -``` js -var hyperquest = require('hyperquest'); -``` - -## var req = hyperquest(uri, opts={}, cb) - -Create an outgoing http request to `uri` or `opts.uri`. -You need not pass any arguments here since there are setter methods documented -below. - -Return a readable or duplex stream depending on the `opts.method`. - -Default option values: - -* opts.method - `"GET"` -* opts.headers - `{}` -* opts.auth - undefined, but is set automatically when the `uri` has an auth -string in it such as `"http://user:passwd@host"`. `opts.auth` is of the form -`"user:pass"`, just like `http.request()`. - -In https mode, you can specify options to the underlying `tls.connect()` call: - -* opts.pfx -* opts.key -* opts.cert -* opts.ca -* opts.ciphers -* opts.rejectUnauthorized -* opts.secureProtocol - -The request does not go through until the `nextTick` so you can set values -outside of the `opts` so long as they are called on the same tick. - -Optionally you can pass a `cb(err, res)` to set up listeners for `'error'` and -`'response'` events in one place. - -Note that the optional `cb` is NOT like -[request](https://github.com/mikeal/request) -in that hyperquest will not buffer content for you or decode to json or any such -magical thing. - -## req.setHeader(key, value); - -Set an outgoing header `key` to `value`. - -## req.setLocation(uri); - -Set the location if you didn't specify it in the `hyperquest()` call. - -## var req = hyperquest.get(uri, opts, cb) - -Return a readable stream from `hyperquest(..., { method: 'GET' })`. - -## var req = hyperquest.put(uri, opts, cb) - -Return a duplex stream from `hyperquest(..., { method: 'PUT' })`. - -## var req = hyperquest.post(uri, opts, cb) - -Return a duplex stream from `hyperquest(..., { method: 'POST' })`. - -## var req = hyperquest.delete(uri, opts, cb) - -Return a readable stream from `hyperquest(..., { method: 'DELETE' })`. - -# events - -## req.on('response', function (res) {}) - -The `'response'` event is forwarded from the underlying `http.request()`. - -## req.on('error', function (res) {}) - -The `'error'` event is forwarded from the underlying `http.request()`. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install hyperquest -``` - -# license - -MIT diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth.js deleted file mode 100644 index 6e711480..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'moo' && s[1] === 'hax') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic auth', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://moo:hax@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://beep:boop@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth_encoded.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth_encoded.js deleted file mode 100644 index bac51264..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth_encoded.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'm##' && s[1] === 'h@x') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic auth with escaped params', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://m%23%23:h%40x@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://beep:boop@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth_opt.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth_opt.js deleted file mode 100644 index f85f979e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/auth_opt.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'moo' && s[1] === 'hax') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic opts.auth', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://localhost:' + port, { auth: 'moo:hax' }); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://localhost:' + port, { auth: 'beep:boop' }); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/get.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/get.js deleted file mode 100644 index db6720d7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/get.js +++ /dev/null @@ -1,33 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.setHeader('content-type', 'text/robot-speak'); - res.end('beep boop'); -}); - -test('get', function (t) { - t.plan(2); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - r.pipe(through(write, end)); - - r.on('response', function (res) { - t.equal(res.headers['content-type'], 'text/robot-speak'); - }); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/many.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/many.js deleted file mode 100644 index 40b18b36..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/many.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.write('beep boop'); -}); - -test('more than 5 pending connections', function (t) { - t.plan(20); - var pending = []; - server.listen(0, function () { - var port = server.address().port; - for (var i = 0; i < 20; i++) { - pending.push(check(t, port)); - } - }); - t.on('end', function () { - pending.forEach(function (p) { p.destroy() }); - server.close(); - }); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.pipe(through(function (buf) { data += buf })); - - setTimeout(function () { - t.equal(data, 'beep boop'); - }, 100); - return r; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/opts.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/opts.js deleted file mode 100644 index a8b4604f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/opts.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.setHeader('content-type', 'text/robot-speak'); - res.end('beep boop'); -}); - -test('1st-arg options', function (t) { - t.plan(2); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest( - { uri: 'http://localhost:' + port }, - function (err, res) { - t.equal(res.headers['content-type'], 'text/robot-speak'); - } - ); - r.pipe(through(write, end)); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/post.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/post.js deleted file mode 100644 index fefc0643..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/post.js +++ /dev/null @@ -1,38 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - req.pipe(through(function (buf) { - this.queue(String(buf).toUpperCase()); - })).pipe(res); -}); - -test('post', function (t) { - t.plan(1); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest.post('http://localhost:' + port); - r.pipe(through(write, end)); - - setTimeout(function () { - r.write('beep '); - }, 50); - - setTimeout(function () { - r.end('boop.'); - }, 100); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'BEEP BOOP.'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/post_immediate.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/post_immediate.js deleted file mode 100644 index ed8606fa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/post_immediate.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - req.pipe(through(function (buf) { - this.queue(String(buf).toUpperCase()); - })).pipe(res); -}); - -test('post', function (t) { - t.plan(1); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest.post('http://localhost:' + port); - r.end('beep boop.'); - - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { - t.equal(data, 'BEEP BOOP.'); - }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/set_header.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/set_header.js deleted file mode 100644 index 6a5c59e8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperquest/test/set_header.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -test('setHeader on a request', function (t) { - t.plan(2); - - var server = http.createServer(function (req, res) { - t.equal(req.headers.robot, 'party'); - res.end('beep boop'); - }); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - r.setHeader('robot', 'party'); - r.pipe(through(write, end)); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/.npmignore deleted file mode 100644 index 0b1d3fa0..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/README.md deleted file mode 100644 index c40b1c4f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# hyperzip - -Make hyperquest requests that have full support for gzip and deflate encoding (server side only) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/index.js deleted file mode 100644 index 160fbd8f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/index.js +++ /dev/null @@ -1,62 +0,0 @@ -var through = require('through'); -var duplexer = require('duplexer'); -var zlib = require('zlib'); -var hyperquest = require('hyperquest'); - -module.exports = zip; -module.exports.request = zip(hyperquest); - -function zip(subquest) { - if (subquest === undefined) subquest = hyperquest; - if (typeof subquest.request === 'function') subquest = subquest.request; - if (subquest.isCap) throw new Error('The subquest argument "' + subquest + '" was invalid. You must use a valid hyperquest module that is not a cap.'); - function request(uri, opts, cb) { - if (typeof uri === 'object') { - cb = opts; - opts = uri; - uri = undefined; - } - if (typeof opts === 'function') { - cb = opts; - opts = undefined; - } - if (!opts) opts = {}; - if (uri !== undefined) opts.uri = uri; - - opts.headers = opts.headers || {}; - opts.headers['Accept-Encoding'] = opts.headers['Accept-Encoding'] ? opts.headers['Accept-Encoding'] + ',gzip,deflate' : 'gzip,deflate'; - - var method = (opts.method || 'GET').toUpperCase(); - var duplex = (method != 'GET' && method != 'DELETE'); - - var rs = through(); - var ws = hyperquest(opts, function (err, res) { - if (err) dup.emit('error', err); - switch (res.headers['content-encoding']) { - case 'gzip': - res.headers['content-encoding'] = null; - this.pipe(zlib.createGunzip()).pipe(rs); - break; - case 'deflate': - res.headers['content-encoding'] = null; - this.pipe(zlib.createInflate()).pipe(rs); - break; - default: - this.pipe(rs); - break; - } - dup.emit('response', res); - }) - var dup = duplex ? duplexer(ws, rs) : rs; - - if (cb) { - dup.on('error', cb); - dup.on('response', function (res) { - cb.call(dup, null, res); - }); - } - return dup; - } - request.request = request; - return request; -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/.npmignore deleted file mode 100644 index 062c11e8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -*.log -*.err \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/.travis.yml deleted file mode 100644 index ed05f88d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.11" - - "0.10" - - "0.8" - - "0.6" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/LICENCE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/LICENCE deleted file mode 100644 index a23e08a8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Raynos. - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/README.md deleted file mode 100644 index 61ff71aa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# duplexer - -[![build status][1]][2] [![dependency status][3]][4] - -[![browser support][5]][6] - -Creates a duplex stream - -Taken from [event-stream][7] - -## duplex (writeStream, readStream) - -Takes a writable stream and a readable stream and makes them appear as a readable writable stream. - -It is assumed that the two streams are connected to each other in some way. - -## Example - -```js -var grep = cp.exec('grep Stream') - -duplex(grep.stdin, grep.stdout) -``` - -## Installation - -`npm install duplexer` - -## Tests - -`npm test` - -## Contributors - - - Dominictarr - - Raynos - - samccone - -## MIT Licenced - - [1]: https://secure.travis-ci.org/Raynos/duplexer.png - [2]: https://travis-ci.org/Raynos/duplexer - [3]: https://david-dm.org/Raynos/duplexer.png - [4]: https://david-dm.org/Raynos/duplexer - [5]: https://ci.testling.com/Raynos/duplexer.png - [6]: https://ci.testling.com/Raynos/duplexer - [7]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/index.js deleted file mode 100644 index a188a210..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/index.js +++ /dev/null @@ -1,87 +0,0 @@ -var Stream = require("stream") -var writeMethods = ["write", "end", "destroy"] -var readMethods = ["resume", "pause"] -var readEvents = ["data", "close"] -var slice = Array.prototype.slice - -module.exports = duplex - -function forEach (arr, fn) { - if (arr.forEach) { - return arr.forEach(fn) - } - - for (var i = 0; i < arr.length; i++) { - fn(arr[i], i) - } -} - -function duplex(writer, reader) { - var stream = new Stream() - var ended = false - - forEach(writeMethods, proxyWriter) - - forEach(readMethods, proxyReader) - - forEach(readEvents, proxyStream) - - reader.on("end", handleEnd) - - writer.on("drain", function() { - stream.emit("drain") - }) - - writer.on("error", reemit) - reader.on("error", reemit) - - stream.writable = writer.writable - stream.readable = reader.readable - - return stream - - function proxyWriter(methodName) { - stream[methodName] = method - - function method() { - return writer[methodName].apply(writer, arguments) - } - } - - function proxyReader(methodName) { - stream[methodName] = method - - function method() { - stream.emit(methodName) - var func = reader[methodName] - if (func) { - return func.apply(reader, arguments) - } - reader.emit(methodName) - } - } - - function proxyStream(methodName) { - reader.on(methodName, reemit) - - function reemit() { - var args = slice.call(arguments) - args.unshift(methodName) - stream.emit.apply(stream, args) - } - } - - function handleEnd() { - if (ended) { - return - } - ended = true - var args = slice.call(arguments) - args.unshift("end") - stream.emit.apply(stream, args) - } - - function reemit(err) { - stream.emit("error", err) - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/package.json deleted file mode 100644 index 86ab2145..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "duplexer", - "version": "0.1.1", - "description": "Creates a duplex stream", - "keywords": [], - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/Raynos/duplexer.git" - }, - "main": "index", - "homepage": "https://github.com/Raynos/duplexer", - "contributors": [ - { - "name": "Jake Verbaten" - } - ], - "bugs": { - "url": "https://github.com/Raynos/duplexer/issues", - "email": "raynos2@gmail.com" - }, - "devDependencies": { - "tape": "0.3.3", - "through": "~0.1.4" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Raynos/duplexer/raw/master/LICENSE" - } - ], - "scripts": { - "test": "node test" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest" - ] - }, - "readme": "# duplexer\n\n[![build status][1]][2] [![dependency status][3]][4]\n\n[![browser support][5]][6]\n\nCreates a duplex stream\n\nTaken from [event-stream][7]\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way.\n\n## Example\n\n```js\nvar grep = cp.exec('grep Stream')\n\nduplex(grep.stdin, grep.stdout)\n```\n\n## Installation\n\n`npm install duplexer`\n\n## Tests\n\n`npm test`\n\n## Contributors\n\n - Dominictarr\n - Raynos\n - samccone\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/duplexer.png\n [2]: https://travis-ci.org/Raynos/duplexer\n [3]: https://david-dm.org/Raynos/duplexer.png\n [4]: https://david-dm.org/Raynos/duplexer\n [5]: https://ci.testling.com/Raynos/duplexer.png\n [6]: https://ci.testling.com/Raynos/duplexer\n [7]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream\n", - "readmeFilename": "README.md", - "_id": "duplexer@0.1.1", - "_from": "duplexer@~0.1.1" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/test/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/test/index.js deleted file mode 100644 index 4988e0d9..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/duplexer/test/index.js +++ /dev/null @@ -1,31 +0,0 @@ -var through = require("through") -var test = require("tape") - -var duplex = require("../index") - -var readable = through() -var writable = through(write) -var written = 0 -var data = 0 - -var stream = duplex(writable, readable) - -function write() { - written++ -} - -stream.on("data", ondata) - -function ondata() { - data++ -} - -test("emit and write", function(t) { - t.plan(2) - - stream.write() - readable.emit("data") - - t.equal(written, 1, "should have written once") - t.equal(data, 1, "should have recived once") -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/.travis.yml deleted file mode 100644 index dad2273c..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.8 - - "0.10" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/LICENSE deleted file mode 100644 index ee27ba4b..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/example/many_request.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/example/many_request.js deleted file mode 100644 index abbc28ea..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/example/many_request.js +++ /dev/null @@ -1,20 +0,0 @@ -var http = require('http'); -var request = require('request'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = request('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/example/req.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/example/req.js deleted file mode 100644 index 2d73de7e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/example/req.js +++ /dev/null @@ -1,2 +0,0 @@ -var hyperquest = require('../'); -hyperquest('http://localhost:8000').pipe(process.stdout); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/index.js deleted file mode 100644 index 73d66748..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/index.js +++ /dev/null @@ -1,139 +0,0 @@ -var url = require('url'); -var http = require('http'); -var https = require('https'); -var through = require('through'); -var duplexer = require('duplexer'); - -module.exports = hyperquest; - -function bind (obj, fn) { - var args = Array.prototype.slice.call(arguments, 2); - return function () { - var argv = args.concat(Array.prototype.slice.call(arguments)); - return fn.apply(obj, argv); - } -} - -function hyperquest (uri, opts, cb, extra) { - if (typeof uri === 'object') { - cb = opts; - opts = uri; - uri = undefined; - } - if (typeof opts === 'function') { - cb = opts; - opts = undefined; - } - if (!opts) opts = {}; - if (uri !== undefined) opts.uri = uri; - if (extra) opts.method = extra.method; - - var req = new Req(opts); - var ws = req.duplex && through(); - if (ws) ws.pause(); - var rs = through(); - - var dup = req.duplex ? duplexer(ws, rs) : rs; - if (!req.duplex) { - rs.writable = false; - } - dup.request = req; - dup.setHeader = bind(req, req.setHeader); - dup.setLocation = bind(req, req.setLocation); - - var closed = false; - dup.on('close', function () { closed = true }); - - process.nextTick(function () { - if (closed) return; - dup.on('close', function () { r.destroy() }); - - var r = req._send(); - r.on('error', bind(dup, dup.emit, 'error')); - - r.on('response', function (res) { - dup.response = res; - dup.emit('response', res); - if (req.duplex) res.pipe(rs) - else { - res.on('data', function (buf) { rs.queue(buf) }); - res.on('end', function () { rs.queue(null) }); - } - }); - - if (req.duplex) { - ws.pipe(r); - ws.resume(); - } - else r.end(); - }); - - if (cb) { - dup.on('error', cb); - dup.on('response', bind(dup, cb, null)); - } - return dup; -} - -hyperquest.get = hyperquest; - -hyperquest.post = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'POST' }); -}; - -hyperquest.put = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'PUT' }); -}; - -hyperquest['delete'] = function (uri, opts, cb) { - return hyperquest(uri, opts, cb, { method: 'DELETE' }); -}; - -function Req (opts) { - this.headers = opts.headers || {}; - - var method = (opts.method || 'GET').toUpperCase(); - this.method = method; - this.duplex = !(method === 'GET' || method === 'DELETE' - || method === 'HEAD'); - this.auth = opts.auth; - - if (opts.uri) this.setLocation(opts.uri); -} - -Req.prototype._send = function () { - this._sent = true; - - var headers = this.headers || {}; - var u = url.parse(this.uri); - var au = u.auth || this.auth; - if (au) { - headers.authorization = 'Basic ' + Buffer(au).toString('base64'); - } - - var protocol = u.protocol || ''; - var iface = protocol === 'https:' ? https : http; - var req = iface.request({ - scheme: protocol.replace(/:$/, ''), - method: this.method, - host: u.hostname, - port: Number(u.port), - path: u.path, - agent: false, - headers: headers - }); - - if (req.setTimeout) req.setTimeout(Math.pow(2, 32) * 1000); - return req; -}; - -Req.prototype.setHeader = function (key, value) { - if (this._sent) throw new Error('request already sent'); - this.headers[key] = value; - return this; -}; - -Req.prototype.setLocation = function (uri) { - this.uri = uri; - return this; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/package.json deleted file mode 100644 index 621c7a57..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "hyperquest", - "version": "0.1.8", - "description": "make streaming http requests", - "main": "index.js", - "dependencies": { - "through": "~2.2.0", - "duplexer": "~0.1.0" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "scripts": { - "test": "tap test/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/substack/hyperquest.git" - }, - "homepage": "https://github.com/substack/hyperquest", - "keywords": [ - "stream", - "http", - "transport", - "request", - "get", - "post", - "put", - "delete", - "duplex", - "pooling" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "license": "MIT", - "readme": "# hyperquest\n\ntreat http requests as a streaming transport\n\n[![build status](https://secure.travis-ci.org/substack/hyperquest.png)](http://travis-ci.org/substack/hyperquest)\n\nThe hyperquest api is a subset of [request](https://github.com/mikeal/request).\n\nThis module works in the browser with [browserify](http://browserify.org).\n\n# rant\n\n![animated gif rant](http://substack.net/images/substack.gif)\n\nThis module disables a lot of infuriating things about core http that WILL cause\nbugs in your application if you think of http as just another kind of stream:\n\n* http requests have a default idle timeout of 2 minutes. This is terrible if\nyou just want to pipe together a bunch of persistent backend processes over\nhttp.\n\n* There is a default connection pool of 5 requests. If you have 5 or more extant\nhttp requests, any additional requests will HANG for NO GOOD REASON.\n\nhyperquest turns these annoyances off so you can just pretend that core http is\njust a fancier version of tcp and not the horrible monstrosity that it actually\nis.\n\nI have it on good authority that these annoyances will be fixed in node 0.12.\n\n# example\n\n# simple streaming GET\n\n``` js\nvar hyperquest = require('hyperquest');\nhyperquest('http://localhost:8000').pipe(process.stdout);\n```\n\n```\n$ node example/req.js\nbeep boop\n```\n\n# pooling is evil\n\nNow to drive the point home about pooling being evil and almost always never\nwhat you want ever.\n\n[request](https://github.com/mikeal/request)\nhas its own forever agent thing that works pretty much the same as node core\nhttp.request: the wrong, horrible, broken way.\n\nFor instance, the following request code takes 12+ seconds to finish:\n\n``` js\nvar http = require('http');\nvar request = require('request');\n\nvar server = http.createServer(function (req, res) {\n res.write(req.url.slice(1) + '\\n');\n setTimeout(res.end.bind(res), 3000);\n});\n\nserver.listen(5000, function () {\n var pending = 20;\n for (var i = 0; i < 20; i++) {\n var r = request('http://localhost:5000/' + i);\n r.pipe(process.stdout, { end: false });\n r.on('end', function () {\n if (--pending === 0) server.close();\n });\n }\n});\n\nprocess.stdout.setMaxListeners(0); // turn off annoying warnings\n```\n\n```\nsubstack : example $ time node many_request.js \n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\nreal 0m12.423s\nuser 0m0.424s\nsys 0m0.048s\n```\n\nSurprising? YES. This is pretty much never what you want, particularly if you\nhave a lot of streaming http API endpoints. Your code will just *HANG* once the\nconnection pool fills up and it won't start working again until some connections\ndie for whatever reason. I have encountered this so many times in production\ninstances and it is SO hard to track down reliably.\n\nCompare to using hyperquest, which is exactly the same code but it takes 3\nseconds instead of 12 to finish because it's not completely self-crippled like\nrequest and core http.request.\n\n``` js\nvar http = require('http');\nvar hyperquest = require('hyperquest');\n\nvar server = http.createServer(function (req, res) {\n res.write(req.url.slice(1) + '\\n');\n setTimeout(res.end.bind(res), 3000);\n});\n\nserver.listen(5000, function () {\n var pending = 20;\n for (var i = 0; i < 20; i++) {\n var r = hyperquest('http://localhost:5000/' + i);\n r.pipe(process.stdout, { end: false });\n r.on('end', function () {\n if (--pending === 0) server.close();\n });\n }\n});\n\nprocess.stdout.setMaxListeners(0); // turn off annoying warnings\n```\n```\n$ time node many_hyperquest.js \n0\n1\n2\n3\n4\n5\n6\n8\n9\n7\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\nreal 0m3.284s\nuser 0m0.288s\nsys 0m0.060s\n```\n\nSo the other thing is, the justification I've heard supporting this horrible\nlimit-of-5 pooling behavior is \"performance\". The first example which has been\ntuned for \"performance\" takes 12 seconds. The second example that removes these\n\"performance\" enhancements takes 3. Some performance improvement INDEED!\n\n# methods\n\n``` js\nvar hyperquest = require('hyperquest');\n```\n\n## var req = hyperquest(uri, opts={}, cb)\n\nCreate an outgoing http request to `uri` or `opts.uri`.\nYou need not pass any arguments here since there are setter methods documented\nbelow.\n\nReturn a readable or duplex stream depending on the `opts.method`.\n\nDefault option values:\n\n* opts.method - `\"GET\"`\n* opts.headers - `{}`\n* opts.auth - undefined, but is set automatically when the `uri` has an auth\nstring in it such as `\"http://user:passwd@host\"`. `opts.auth` is of the form\n`\"user:pass\"`, just like `http.request()`.\n\nThe request does not go through until the `nextTick` so you can set values\noutside of the `opts` so long as they are called on the same tick.\n\nOptionally you can pass a `cb(err, res)` to set up listeners for `'error'` and\n`'response'` events in one place.\n\nNote that the optional `cb` is NOT like\n[request](https://github.com/mikeal/request)\nin that hyperquest will not buffer content for you or decode to json or any such\nmagical thing.\n\n## req.setHeader(key, value);\n\nSet an outgoing header `key` to `value`.\n\n## req.setLocation(uri);\n\nSet the location if you didn't specify it in the `hyperquest()` call.\n\n## var req = hyperquest.get(uri, opts, cb)\n\nReturn a readable stream from `hyperquest(..., { method: 'GET' })`.\n\n## var req = hyperquest.put(uri, opts, cb)\n\nReturn a duplex stream from `hyperquest(..., { method: 'PUT' })`.\n\n## var req = hyperquest.post(uri, opts, cb)\n\nReturn a duplex stream from `hyperquest(..., { method: 'POST' })`.\n\n## var req = hyperquest.delete(uri, opts, cb)\n\nReturn a readable stream from `hyperquest(..., { method: 'DELETE' })`.\n\n# events\n\n## req.on('response', function (res) {})\n\nThe `'response'` event is forwarded from the underlying `http.request()`.\n\n## req.on('error', function (res) {})\n\nThe `'error'` event is forwarded from the underlying `http.request()`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install hyperquest\n```\n\n# license\n\nMIT\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/substack/hyperquest/issues" - }, - "_id": "hyperquest@0.1.8", - "_from": "hyperquest@~0.1.5" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/readme.markdown b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/readme.markdown deleted file mode 100644 index af7bdf01..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/readme.markdown +++ /dev/null @@ -1,249 +0,0 @@ -# hyperquest - -treat http requests as a streaming transport - -[![build status](https://secure.travis-ci.org/substack/hyperquest.png)](http://travis-ci.org/substack/hyperquest) - -The hyperquest api is a subset of [request](https://github.com/mikeal/request). - -This module works in the browser with [browserify](http://browserify.org). - -# rant - -![animated gif rant](http://substack.net/images/substack.gif) - -This module disables a lot of infuriating things about core http that WILL cause -bugs in your application if you think of http as just another kind of stream: - -* http requests have a default idle timeout of 2 minutes. This is terrible if -you just want to pipe together a bunch of persistent backend processes over -http. - -* There is a default connection pool of 5 requests. If you have 5 or more extant -http requests, any additional requests will HANG for NO GOOD REASON. - -hyperquest turns these annoyances off so you can just pretend that core http is -just a fancier version of tcp and not the horrible monstrosity that it actually -is. - -I have it on good authority that these annoyances will be fixed in node 0.12. - -# example - -# simple streaming GET - -``` js -var hyperquest = require('hyperquest'); -hyperquest('http://localhost:8000').pipe(process.stdout); -``` - -``` -$ node example/req.js -beep boop -``` - -# pooling is evil - -Now to drive the point home about pooling being evil and almost always never -what you want ever. - -[request](https://github.com/mikeal/request) -has its own forever agent thing that works pretty much the same as node core -http.request: the wrong, horrible, broken way. - -For instance, the following request code takes 12+ seconds to finish: - -``` js -var http = require('http'); -var request = require('request'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = request('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings -``` - -``` -substack : example $ time node many_request.js -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 - -real 0m12.423s -user 0m0.424s -sys 0m0.048s -``` - -Surprising? YES. This is pretty much never what you want, particularly if you -have a lot of streaming http API endpoints. Your code will just *HANG* once the -connection pool fills up and it won't start working again until some connections -die for whatever reason. I have encountered this so many times in production -instances and it is SO hard to track down reliably. - -Compare to using hyperquest, which is exactly the same code but it takes 3 -seconds instead of 12 to finish because it's not completely self-crippled like -request and core http.request. - -``` js -var http = require('http'); -var hyperquest = require('hyperquest'); - -var server = http.createServer(function (req, res) { - res.write(req.url.slice(1) + '\n'); - setTimeout(res.end.bind(res), 3000); -}); - -server.listen(5000, function () { - var pending = 20; - for (var i = 0; i < 20; i++) { - var r = hyperquest('http://localhost:5000/' + i); - r.pipe(process.stdout, { end: false }); - r.on('end', function () { - if (--pending === 0) server.close(); - }); - } -}); - -process.stdout.setMaxListeners(0); // turn off annoying warnings -``` -``` -$ time node many_hyperquest.js -0 -1 -2 -3 -4 -5 -6 -8 -9 -7 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 - -real 0m3.284s -user 0m0.288s -sys 0m0.060s -``` - -So the other thing is, the justification I've heard supporting this horrible -limit-of-5 pooling behavior is "performance". The first example which has been -tuned for "performance" takes 12 seconds. The second example that removes these -"performance" enhancements takes 3. Some performance improvement INDEED! - -# methods - -``` js -var hyperquest = require('hyperquest'); -``` - -## var req = hyperquest(uri, opts={}, cb) - -Create an outgoing http request to `uri` or `opts.uri`. -You need not pass any arguments here since there are setter methods documented -below. - -Return a readable or duplex stream depending on the `opts.method`. - -Default option values: - -* opts.method - `"GET"` -* opts.headers - `{}` -* opts.auth - undefined, but is set automatically when the `uri` has an auth -string in it such as `"http://user:passwd@host"`. `opts.auth` is of the form -`"user:pass"`, just like `http.request()`. - -The request does not go through until the `nextTick` so you can set values -outside of the `opts` so long as they are called on the same tick. - -Optionally you can pass a `cb(err, res)` to set up listeners for `'error'` and -`'response'` events in one place. - -Note that the optional `cb` is NOT like -[request](https://github.com/mikeal/request) -in that hyperquest will not buffer content for you or decode to json or any such -magical thing. - -## req.setHeader(key, value); - -Set an outgoing header `key` to `value`. - -## req.setLocation(uri); - -Set the location if you didn't specify it in the `hyperquest()` call. - -## var req = hyperquest.get(uri, opts, cb) - -Return a readable stream from `hyperquest(..., { method: 'GET' })`. - -## var req = hyperquest.put(uri, opts, cb) - -Return a duplex stream from `hyperquest(..., { method: 'PUT' })`. - -## var req = hyperquest.post(uri, opts, cb) - -Return a duplex stream from `hyperquest(..., { method: 'POST' })`. - -## var req = hyperquest.delete(uri, opts, cb) - -Return a readable stream from `hyperquest(..., { method: 'DELETE' })`. - -# events - -## req.on('response', function (res) {}) - -The `'response'` event is forwarded from the underlying `http.request()`. - -## req.on('error', function (res) {}) - -The `'error'` event is forwarded from the underlying `http.request()`. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install hyperquest -``` - -# license - -MIT diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth.js deleted file mode 100644 index 6e711480..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'moo' && s[1] === 'hax') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic auth', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://moo:hax@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://beep:boop@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth_encoded.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth_encoded.js deleted file mode 100644 index bac51264..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth_encoded.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'm##' && s[1] === 'h@x') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic auth with escaped params', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://m%23%23:h%40x@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://beep:boop@localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth_opt.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth_opt.js deleted file mode 100644 index f85f979e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/auth_opt.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - var au = req.headers.authorization; - if (!au) return res.end('ACCESS DENIED'); - - var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64'); - var s = buf.toString().split(':'); - - if (s[0] === 'moo' && s[1] === 'hax') { - res.end('WELCOME TO ZOMBO COM'); - } - else { - res.end('ACCESS DENIED!!!'); - } -}); - -test('basic opts.auth', function (t) { - t.plan(3); - server.listen(0, function () { - var port = server.address().port; - checkUnauth(t, port); - checkValid(t, port); - checkInvalid(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function checkUnauth (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED') }); -} - -function checkValid (t, port) { - var r = hyperquest('http://localhost:' + port, { auth: 'moo:hax' }); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') }); -} - -function checkInvalid (t, port) { - var r = hyperquest('http://localhost:' + port, { auth: 'beep:boop' }); - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/get.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/get.js deleted file mode 100644 index db6720d7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/get.js +++ /dev/null @@ -1,33 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.setHeader('content-type', 'text/robot-speak'); - res.end('beep boop'); -}); - -test('get', function (t) { - t.plan(2); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - r.pipe(through(write, end)); - - r.on('response', function (res) { - t.equal(res.headers['content-type'], 'text/robot-speak'); - }); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/many.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/many.js deleted file mode 100644 index 40b18b36..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/many.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.write('beep boop'); -}); - -test('more than 5 pending connections', function (t) { - t.plan(20); - var pending = []; - server.listen(0, function () { - var port = server.address().port; - for (var i = 0; i < 20; i++) { - pending.push(check(t, port)); - } - }); - t.on('end', function () { - pending.forEach(function (p) { p.destroy() }); - server.close(); - }); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - var data = ''; - r.pipe(through(function (buf) { data += buf })); - - setTimeout(function () { - t.equal(data, 'beep boop'); - }, 100); - return r; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/opts.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/opts.js deleted file mode 100644 index a8b4604f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/opts.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - res.setHeader('content-type', 'text/robot-speak'); - res.end('beep boop'); -}); - -test('1st-arg options', function (t) { - t.plan(2); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest( - { uri: 'http://localhost:' + port }, - function (err, res) { - t.equal(res.headers['content-type'], 'text/robot-speak'); - } - ); - r.pipe(through(write, end)); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/post.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/post.js deleted file mode 100644 index fefc0643..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/post.js +++ /dev/null @@ -1,38 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - req.pipe(through(function (buf) { - this.queue(String(buf).toUpperCase()); - })).pipe(res); -}); - -test('post', function (t) { - t.plan(1); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest.post('http://localhost:' + port); - r.pipe(through(write, end)); - - setTimeout(function () { - r.write('beep '); - }, 50); - - setTimeout(function () { - r.end('boop.'); - }, 100); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'BEEP BOOP.'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/post_immediate.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/post_immediate.js deleted file mode 100644 index ed8606fa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/post_immediate.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -var server = http.createServer(function (req, res) { - req.pipe(through(function (buf) { - this.queue(String(buf).toUpperCase()); - })).pipe(res); -}); - -test('post', function (t) { - t.plan(1); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest.post('http://localhost:' + port); - r.end('beep boop.'); - - var data = ''; - r.on('data', function (buf) { data += buf }); - r.on('end', function () { - t.equal(data, 'BEEP BOOP.'); - }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/set_header.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/set_header.js deleted file mode 100644 index 6a5c59e8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/hyperquest/test/set_header.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tap').test; -var http = require('http'); -var hyperquest = require('../'); -var through = require('through'); - -test('setHeader on a request', function (t) { - t.plan(2); - - var server = http.createServer(function (req, res) { - t.equal(req.headers.robot, 'party'); - res.end('beep boop'); - }); - server.listen(0, function () { - var port = server.address().port; - check(t, port); - }); - t.on('end', server.close.bind(server)); -}); - -function check (t, port) { - var r = hyperquest('http://localhost:' + port); - r.setHeader('robot', 'party'); - r.pipe(through(write, end)); - - var data = ''; - function write (buf) { data += buf } - function end () { - t.equal(data, 'beep boop'); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/.travis.yml deleted file mode 100644 index c693a939..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - "0.10" diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/LICENSE.APACHE2 b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/LICENSE.APACHE2 deleted file mode 100644 index 6366c047..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/LICENSE.APACHE2 +++ /dev/null @@ -1,15 +0,0 @@ -Apache License, Version 2.0 - -Copyright (c) 2011 Dominic Tarr - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/LICENSE.MIT b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/LICENSE.MIT deleted file mode 100644 index 6eafbd73..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/LICENSE.MIT +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2011 Dominic Tarr - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/index.js deleted file mode 100644 index 7b935bf9..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/index.js +++ /dev/null @@ -1,108 +0,0 @@ -var Stream = require('stream') - -// through -// -// a stream that does nothing but re-emit the input. -// useful for aggregating a series of changing but not ending streams into one stream) - -exports = module.exports = through -through.through = through - -//create a readable writable stream. - -function through (write, end, opts) { - write = write || function (data) { this.queue(data) } - end = end || function () { this.queue(null) } - - var ended = false, destroyed = false, buffer = [], _ended = false - var stream = new Stream() - stream.readable = stream.writable = true - stream.paused = false - -// stream.autoPause = !(opts && opts.autoPause === false) - stream.autoDestroy = !(opts && opts.autoDestroy === false) - - stream.write = function (data) { - write.call(this, data) - return !stream.paused - } - - function drain() { - while(buffer.length && !stream.paused) { - var data = buffer.shift() - if(null === data) - return stream.emit('end') - else - stream.emit('data', data) - } - } - - stream.queue = stream.push = function (data) { -// console.error(ended) - if(_ended) return stream - if(data == null) _ended = true - buffer.push(data) - drain() - return stream - } - - //this will be registered as the first 'end' listener - //must call destroy next tick, to make sure we're after any - //stream piped from here. - //this is only a problem if end is not emitted synchronously. - //a nicer way to do this is to make sure this is the last listener for 'end' - - stream.on('end', function () { - stream.readable = false - if(!stream.writable && stream.autoDestroy) - process.nextTick(function () { - stream.destroy() - }) - }) - - function _end () { - stream.writable = false - end.call(stream) - if(!stream.readable && stream.autoDestroy) - stream.destroy() - } - - stream.end = function (data) { - if(ended) return - ended = true - if(arguments.length) stream.write(data) - _end() // will emit or queue - return stream - } - - stream.destroy = function () { - if(destroyed) return - destroyed = true - ended = true - buffer.length = 0 - stream.writable = stream.readable = false - stream.emit('close') - return stream - } - - stream.pause = function () { - if(stream.paused) return - stream.paused = true - return stream - } - - stream.resume = function () { - if(stream.paused) { - stream.paused = false - stream.emit('resume') - } - drain() - //may have become paused again, - //as drain emits 'data'. - if(!stream.paused) - stream.emit('drain') - return stream - } - return stream -} - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/package.json deleted file mode 100644 index 65301c5a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "through", - "version": "2.3.4", - "description": "simplified stream contsruction", - "main": "index.js", - "scripts": { - "test": "set -e; for t in test/*.js; do node $t; done" - }, - "devDependencies": { - "stream-spec": "~0.3.5", - "tape": "~0.2.2" - }, - "keywords": [ - "stream", - "streams", - "user-streams", - "pipe" - ], - "author": { - "name": "Dominic Tarr", - "email": "dominic.tarr@gmail.com", - "url": "dominictarr.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/dominictarr/through.git" - }, - "homepage": "http://github.com/dominictarr/through", - "testling": { - "browsers": [ - "ie/8..latest", - "ff/15..latest", - "chrome/20..latest", - "safari/5.1..latest" - ], - "files": "test/*.js" - }, - "readme": "#through\n\n[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through)\n\nEasy way to create a `Stream` that is both `readable` and `writable`. \n\n* Pass in optional `write` and `end` methods.\n* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.\n* Use `this.pause()` and `this.resume()` to manage flow.\n* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`).\n\nThis function is the basis for most of the synchronous streams in \n[event-stream](http://github.com/dominictarr/event-stream).\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.queue(data) //data *must* not be null\n },\n function end () { //optional\n this.queue(null)\n })\n```\n\nOr, can also be used _without_ buffering on pause, use `this.emit('data', data)`,\nand this.emit('end')\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.emit('data', data)\n //this.pause() \n },\n function end () { //optional\n this.emit('end')\n })\n```\n\n## Extended Options\n\nYou will probably not need these 99% of the time.\n\n### autoDestroy=false\n\nBy default, `through` emits close when the writable\nand readable side of the stream has ended.\nIf that is not desired, set `autoDestroy=false`.\n\n``` js\nvar through = require('through')\n\n//like this\nvar ts = through(write, end, {autoDestroy: false})\n//or like this\nvar ts = through(write, end)\nts.autoDestroy = false\n```\n\n## License\n\nMIT / Apache2\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/dominictarr/through/issues" - }, - "_id": "through@2.3.4", - "_from": "through@~2.3.4" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/readme.markdown b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/readme.markdown deleted file mode 100644 index b20bc9a8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/readme.markdown +++ /dev/null @@ -1,63 +0,0 @@ -#through - -[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through) - -Easy way to create a `Stream` that is both `readable` and `writable`. - -* Pass in optional `write` and `end` methods. -* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`. -* Use `this.pause()` and `this.resume()` to manage flow. -* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`). - -This function is the basis for most of the synchronous streams in -[event-stream](http://github.com/dominictarr/event-stream). - -``` js -var through = require('through') - -through(function write(data) { - this.queue(data) //data *must* not be null - }, - function end () { //optional - this.queue(null) - }) -``` - -Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`, -and this.emit('end') - -``` js -var through = require('through') - -through(function write(data) { - this.emit('data', data) - //this.pause() - }, - function end () { //optional - this.emit('end') - }) -``` - -## Extended Options - -You will probably not need these 99% of the time. - -### autoDestroy=false - -By default, `through` emits close when the writable -and readable side of the stream has ended. -If that is not desired, set `autoDestroy=false`. - -``` js -var through = require('through') - -//like this -var ts = through(write, end, {autoDestroy: false}) -//or like this -var ts = through(write, end) -ts.autoDestroy = false -``` - -## License - -MIT / Apache2 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/auto-destroy.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/auto-destroy.js deleted file mode 100644 index 9a8fd000..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/auto-destroy.js +++ /dev/null @@ -1,30 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - ts.autoDestroy = false - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.notOk(closed) - ts.destroy() - assert.ok(closed) - assert.end() -}) - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/buffering.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/buffering.js deleted file mode 100644 index b0084bfc..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/buffering.js +++ /dev/null @@ -1,71 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('buffering', function(assert) { - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - assert.deepEqual(actual, [1, 2, 3]) - ts.pause() - ts.write(4) - ts.write(5) - ts.write(6) - assert.deepEqual(actual, [1, 2, 3]) - ts.resume() - assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) - ts.pause() - ts.end() - assert.ok(!ended) - ts.resume() - assert.ok(ended) - assert.end() -}) - -test('buffering has data in queue, when ends', function (assert) { - - /* - * If stream ends while paused with data in the queue, - * stream should still emit end after all data is written - * on resume. - */ - - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.pause() - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.deepEqual(actual, [], 'no data written yet, still paused') - assert.ok(!ended, 'end not emitted yet, still paused') - ts.resume() - assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') - assert.ok(ended, 'end should be emitted once all data was delivered') - assert.end(); -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/end.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/end.js deleted file mode 100644 index fa113f58..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/end.js +++ /dev/null @@ -1,45 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.ok(closed) - assert.end() -}) - -test('end only once', function (t) { - - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - t.equal(ended, false) - ended = true - }) - - ts.queue(null) - ts.queue(null) - ts.queue(null) - - ts.resume() - - t.end() -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/index.js deleted file mode 100644 index 33e33f96..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/node_modules/through/test/index.js +++ /dev/null @@ -1,114 +0,0 @@ - -var test = require('tape') -var spec = require('stream-spec') -var through = require('../') - -/* - I'm using these two functions, and not streams and pipe - so there is less to break. if this test fails it must be - the implementation of _through_ -*/ - -function write(array, stream) { - array = array.slice() - function next() { - while(array.length) - if(stream.write(array.shift()) === false) - return stream.once('drain', next) - - stream.end() - } - - next() -} - -function read(stream, callback) { - var actual = [] - stream.on('data', function (data) { - actual.push(data) - }) - stream.once('end', function () { - callback(null, actual) - }) - stream.once('error', function (err) { - callback(err) - }) -} - -test('simple defaults', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through() - spec(t) - .through() - .pausable() - .validateOnExit() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - write(expected, t) -}); - -test('simple functions', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through(function (data) { - this.emit('data', data*2) - }) - spec(t) - .through() - .pausable() - .validateOnExit() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected.map(function (data) { - return data*2 - })) - assert.end() - }) - - write(expected, t) -}) - -test('pauses', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l) //Math.random()) - - var t = through() - spec(t) - .through() - .pausable() - .validateOnExit() - - t.on('data', function () { - if(Math.random() > 0.1) return - t.pause() - process.nextTick(function () { - t.resume() - }) - }) - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - write(expected, t) -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/package.json deleted file mode 100644 index 53b8dbb2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/node_modules/hyperzip/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "hyperzip", - "version": "0.0.0", - "description": "Make hyperquest requests that have full support for gzip and deflate encoding (server side only)", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "https://github.com/hyperquest/hyperzip.git" - }, - "author": { - "name": "ForbesLindesay" - }, - "license": "MIT", - "dependencies": { - "duplexer": "~0.1.1", - "through": "~2.3.4", - "hyperquest": "~0.1.5" - }, - "readme": "# hyperzip\r\n\r\nMake hyperquest requests that have full support for gzip and deflate encoding (server side only)\r\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/hyperquest/hyperzip/issues" - }, - "homepage": "https://github.com/hyperquest/hyperzip", - "_id": "hyperzip@0.0.0", - "dist": { - "shasum": "29d2fb5699271d82f59a51b432fe9f341014bfda" - }, - "_from": "hyperzip@", - "_resolved": "https://registry.npmjs.org/hyperzip/-/hyperzip-0.0.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/package.json deleted file mode 100644 index f7ee6a46..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "string_decoder-build", - "version": "0.0.0", - "description": "", - "main": "build.js", - "dependencies": { - "bl": "~0.6.0", - "hyperzip": "0.0.0", - "hyperdirect": "0.0.0", - "cheerio": "~0.13.1" - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/test-replacements.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/test-replacements.js deleted file mode 100644 index 5bbf6028..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/build/test-replacements.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports.all = [ - [ - /require\(['"]string_decoder['"]\)/g - , 'require(\'../../\')' - ] - -] - -module.exports['common.js'] = [ - [ - /^ setImmediate,$/m - , ' typeof setImmediate == \'undefined\' ? null : setImmediate,' - ] - - , [ - /^ clearImmediate,$/m - , ' typeof clearImmediate == \'undefined\' ? null : clearImmediate,' - ] - - , [ - /^ global];$/m - , ' global].filter(Boolean);' - ] -] diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/index.js deleted file mode 100644 index 2e44a03e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/index.js +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - this.charBuffer = new Buffer(6); - this.charReceived = 0; - this.charLength = 0; -}; - - -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - var offset = 0; - - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var i = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, offset, i); - this.charReceived += (i - offset); - offset = i; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (i == buffer.length) return charStr; - - // otherwise cut off the characters end from the beginning of this buffer - buffer = buffer.slice(i, buffer.length); - break; - } - - var lenIncomplete = this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - lenIncomplete, end); - this.charReceived = lenIncomplete; - end -= lenIncomplete; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - this.charBuffer.write(charStr.charAt(charStr.length - 1), this.encoding); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - - return i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - var incomplete = this.charReceived = buffer.length % 2; - this.charLength = incomplete ? 2 : 0; - return incomplete; -} - -function base64DetectIncompleteChar(buffer) { - var incomplete = this.charReceived = buffer.length % 3; - this.charLength = incomplete ? 3 : 0; - return incomplete; -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/package.json deleted file mode 100644 index bf4f67f6..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "string_decoder", - "version": "0.10.25", - "description": "The string_decoder module from Node core", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "tap": "~0.4.8" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/rvagg/string_decoder.git" - }, - "homepage": "https://github.com/rvagg/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT", - "readme": "**string_decoder.js** (`require('string_decoder')`) from Node.js core\n\nCopyright Joyent, Inc. and other Node contributors. See LICENCE file for details.\n\nVersion numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**\n\nThe *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.", - "readmeFilename": "README.md", - "_id": "string_decoder@0.10.25", - "dist": { - "shasum": "c21a1fdf7dea11b4459227df93db7591731ef620" - }, - "_from": "string_decoder@~0.10.x", - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.25.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/common.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/common.js deleted file mode 100644 index ed5ff08d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/common.js +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var path = require('path'); -var assert = require('assert'); - -exports.testDir = path.dirname(__filename); -exports.fixturesDir = path.join(exports.testDir, 'fixtures'); -exports.libDir = path.join(exports.testDir, '../lib'); -exports.tmpDir = path.join(exports.testDir, 'tmp'); -exports.PORT = +process.env.NODE_COMMON_PORT || 12346; - -if (process.platform === 'win32') { - exports.PIPE = '\\\\.\\pipe\\libuv-test'; -} else { - exports.PIPE = exports.tmpDir + '/test.sock'; -} - -var util = require('util'); -for (var i in util) exports[i] = util[i]; -//for (var i in exports) global[i] = exports[i]; - -function protoCtrChain(o) { - var result = []; - for (; o; o = o.__proto__) { result.push(o.constructor); } - return result.join(); -} - -exports.indirectInstanceOf = function(obj, cls) { - if (obj instanceof cls) { return true; } - var clsChain = protoCtrChain(cls.prototype); - var objChain = protoCtrChain(obj); - return objChain.slice(-clsChain.length) === clsChain; -}; - - -exports.ddCommand = function(filename, kilobytes) { - if (process.platform === 'win32') { - var p = path.resolve(exports.fixturesDir, 'create-file.js'); - return '"' + process.argv[0] + '" "' + p + '" "' + - filename + '" ' + (kilobytes * 1024); - } else { - return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes; - } -}; - - -exports.spawnCat = function(options) { - var spawn = require('child_process').spawn; - - if (process.platform === 'win32') { - return spawn('more', [], options); - } else { - return spawn('cat', [], options); - } -}; - - -exports.spawnPwd = function(options) { - var spawn = require('child_process').spawn; - - if (process.platform === 'win32') { - return spawn('cmd.exe', ['/c', 'cd'], options); - } else { - return spawn('pwd', [], options); - } -}; - - -// Turn this off if the test should not check for global leaks. -exports.globalCheck = true; - -process.on('exit', function() { - if (!exports.globalCheck) return; - var knownGlobals = [setTimeout, - setInterval, - typeof setImmediate == 'undefined' ? null : setImmediate, - clearTimeout, - clearInterval, - typeof clearImmediate == 'undefined' ? null : clearImmediate, - console, - Buffer, - process, - global].filter(Boolean); - - if (global.gc) { - knownGlobals.push(gc); - } - - if (global.DTRACE_HTTP_SERVER_RESPONSE) { - knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE); - knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST); - knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE); - knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST); - knownGlobals.push(DTRACE_NET_STREAM_END); - knownGlobals.push(DTRACE_NET_SERVER_CONNECTION); - knownGlobals.push(DTRACE_NET_SOCKET_READ); - knownGlobals.push(DTRACE_NET_SOCKET_WRITE); - } - if (global.COUNTER_NET_SERVER_CONNECTION) { - knownGlobals.push(COUNTER_NET_SERVER_CONNECTION); - knownGlobals.push(COUNTER_NET_SERVER_CONNECTION_CLOSE); - knownGlobals.push(COUNTER_HTTP_SERVER_REQUEST); - knownGlobals.push(COUNTER_HTTP_SERVER_RESPONSE); - knownGlobals.push(COUNTER_HTTP_CLIENT_REQUEST); - knownGlobals.push(COUNTER_HTTP_CLIENT_RESPONSE); - } - - if (global.ArrayBuffer) { - knownGlobals.push(ArrayBuffer); - knownGlobals.push(Int8Array); - knownGlobals.push(Uint8Array); - knownGlobals.push(Uint8ClampedArray); - knownGlobals.push(Int16Array); - knownGlobals.push(Uint16Array); - knownGlobals.push(Int32Array); - knownGlobals.push(Uint32Array); - knownGlobals.push(Float32Array); - knownGlobals.push(Float64Array); - knownGlobals.push(DataView); - } - - for (var x in global) { - var found = false; - - for (var y in knownGlobals) { - if (global[x] === knownGlobals[y]) { - found = true; - break; - } - } - - if (!found) { - console.error('Unknown global: %s', x); - assert.ok(false, 'Unknown global found'); - } - } -}); - - -var mustCallChecks = []; - - -function runCallChecks(exitCode) { - if (exitCode !== 0) return; - - var failed = mustCallChecks.filter(function(context) { - return context.actual !== context.expected; - }); - - failed.forEach(function(context) { - console.log('Mismatched %s function calls. Expected %d, actual %d.', - context.name, - context.expected, - context.actual); - console.log(context.stack.split('\n').slice(2).join('\n')); - }); - - if (failed.length) process.exit(1); -} - - -exports.mustCall = function(fn, expected) { - if (typeof expected !== 'number') expected = 1; - - var context = { - expected: expected, - actual: 0, - stack: (new Error).stack, - name: fn.name || '' - }; - - // add the exit listener only once to avoid listener leak warnings - if (mustCallChecks.length === 0) process.on('exit', runCallChecks); - - mustCallChecks.push(context); - - return function() { - context.actual++; - return fn.apply(this, arguments); - }; -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/simple/test-string-decoder-end.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/simple/test-string-decoder-end.js deleted file mode 100644 index 869a4116..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/simple/test-string-decoder-end.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// verify that the string decoder works getting 1 byte at a time, -// the whole buffer at once, and that both match the .toString(enc) -// result of the entire buffer. - -var assert = require('assert'); -var SD = require('../../').StringDecoder; -var encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2']; - -var bufs = [ '☃💩', 'asdf' ].map(function(b) { - return new Buffer(b); -}); - -// also test just arbitrary bytes from 0-15. -for (var i = 1; i <= 16; i++) { - var bytes = new Array(i).join('.').split('.').map(function(_, j) { - return j + 0x78; - }); - bufs.push(new Buffer(bytes)); -} - -encodings.forEach(testEncoding); - -console.log('ok'); - -function testEncoding(encoding) { - bufs.forEach(function(buf) { - testBuf(encoding, buf); - }); -} - -function testBuf(encoding, buf) { - console.error('# %s', encoding, buf); - - // write one byte at a time. - var s = new SD(encoding); - var res1 = ''; - for (var i = 0; i < buf.length; i++) { - res1 += s.write(buf.slice(i, i + 1)); - } - res1 += s.end(); - - // write the whole buffer at once. - var res2 = ''; - var s = new SD(encoding); - res2 += s.write(buf); - res2 += s.end(); - - // .toString() on the buffer - var res3 = buf.toString(encoding); - - console.log('expect=%j', res3); - assert.equal(res1, res3, 'one byte at a time should match toString'); - assert.equal(res2, res3, 'all bytes at once should match toString'); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/simple/test-string-decoder.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/simple/test-string-decoder.js deleted file mode 100644 index 7f69f7ea..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/string_decoder/test/simple/test-string-decoder.js +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var common = require('../common'); -var assert = require('assert'); -var StringDecoder = require('../../').StringDecoder; -var decoder = new StringDecoder('utf8'); - - - -var buffer = new Buffer('$'); -assert.deepEqual('$', decoder.write(buffer)); - -buffer = new Buffer('¢'); -assert.deepEqual('', decoder.write(buffer.slice(0, 1))); -assert.deepEqual('¢', decoder.write(buffer.slice(1, 2))); - -buffer = new Buffer('€'); -assert.deepEqual('', decoder.write(buffer.slice(0, 1))); -assert.deepEqual('', decoder.write(buffer.slice(1, 2))); -assert.deepEqual('€', decoder.write(buffer.slice(2, 3))); - -buffer = new Buffer([0xF0, 0xA4, 0xAD, 0xA2]); -var s = ''; -s += decoder.write(buffer.slice(0, 1)); -s += decoder.write(buffer.slice(1, 2)); -s += decoder.write(buffer.slice(2, 3)); -s += decoder.write(buffer.slice(3, 4)); -assert.ok(s.length > 0); - -// CESU-8 -buffer = new Buffer('EDA0BDEDB18D', 'hex'); // THUMBS UP SIGN (in CESU-8) -var s = ''; -s += decoder.write(buffer.slice(0, 1)); -s += decoder.write(buffer.slice(1, 2)); -s += decoder.write(buffer.slice(2, 3)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(3, 4)); -s += decoder.write(buffer.slice(4, 5)); -s += decoder.write(buffer.slice(5, 6)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 2)); -s += decoder.write(buffer.slice(2, 4)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(4, 6)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 3)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(3, 6)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 4)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(4, 5)); -s += decoder.write(buffer.slice(5, 6)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 5)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(5, 6)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 6)); -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - - -// UCS-2 -decoder = new StringDecoder('ucs2'); -buffer = new Buffer('ab', 'ucs2'); -assert.equal(decoder.write(buffer), 'ab'); // 2 complete chars -buffer = new Buffer('abc', 'ucs2'); -assert.equal(decoder.write(buffer.slice(0, 3)), 'a'); // 'a' and first of 'b' -assert.equal(decoder.write(buffer.slice(3, 6)), 'bc'); // second of 'b' and 'c' - - -// UTF-16LE -buffer = new Buffer('3DD84DDC', 'hex'); // THUMBS UP SIGN (in CESU-8) -var s = ''; -s += decoder.write(buffer.slice(0, 1)); -s += decoder.write(buffer.slice(1, 2)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(2, 3)); -s += decoder.write(buffer.slice(3, 4)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 2)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(2, 4)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 3)); // complete lead surrogate -assert.equal(s, ''); -s += decoder.write(buffer.slice(3, 4)); // complete trail surrogate -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - -var s = ''; -s += decoder.write(buffer.slice(0, 4)); -assert.equal(s, '\uD83D\uDC4D'); // THUMBS UP SIGN (in UTF-16) - - -// A mixed ascii and non-ascii string -// Test stolen from deps/v8/test/cctest/test-strings.cc -// U+02E4 -> CB A4 -// U+0064 -> 64 -// U+12E4 -> E1 8B A4 -// U+0030 -> 30 -// U+3045 -> E3 81 85 -var expected = '\u02e4\u0064\u12e4\u0030\u3045'; -var buffer = new Buffer([0xCB, 0xA4, 0x64, 0xE1, 0x8B, 0xA4, - 0x30, 0xE3, 0x81, 0x85]); -var charLengths = [0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 5]; - -// Split the buffer into 3 segments -// |----|------|-------| -// 0 i j buffer.length -// Scan through every possible 3 segment combination -// and make sure that the string is always parsed. -common.print('scanning '); -for (var j = 2; j < buffer.length; j++) { - for (var i = 1; i < j; i++) { - var decoder = new StringDecoder('utf8'); - - var sum = decoder.write(buffer.slice(0, i)); - - // just check that we've received the right amount - // after the first write - assert.equal(charLengths[i], sum.length); - - sum += decoder.write(buffer.slice(i, j)); - sum += decoder.write(buffer.slice(j, buffer.length)); - assert.equal(expected, sum); - common.print('.'); - } -} -console.log(' crayon!'); - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/package.json deleted file mode 100644 index 3bf407fd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "readable-stream", - "version": "1.1.10", - "description": "An exploration of a new kind of readable streams for Node.js", - "main": "readable.js", - "dependencies": { - "core-util-is": "~1.0.0", - "string_decoder": "~0.10.x", - "debuglog": "0.0.2" - }, - "devDependencies": { - "tap": "~0.2.6" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/readable-stream" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "optionalDependencies": { - "debuglog": "0.0.2" - }, - "readme": "# readable-stream\n\nA new class of streams for Node.js\n\nThis module provides the new Stream base classes introduced in Node\nv0.10, for use in Node v0.8. You can use it to have programs that\nhave to work with node v0.8, while being forward-compatible for v0.10\nand beyond. When you drop support for v0.8, you can remove this\nmodule, and only use the native streams.\n\nThis is almost exactly the same codebase as appears in Node v0.10.\nHowever:\n\n1. The exported object is actually the Readable class. Decorating the\n native `stream` module would be global pollution.\n2. In v0.10, you can safely use `base64` as an argument to\n `setEncoding` in Readable streams. However, in v0.8, the\n StringDecoder class has no `end()` method, which is problematic for\n Base64. So, don't use that, because it'll break and be weird.\n\nOther than that, the API is the same as `require('stream')` in v0.10,\nso the API docs are reproduced below.\n\n----------\n\n Stability: 2 - Unstable\n\nA stream is an abstract interface implemented by various objects in\nNode. For example a request to an HTTP server is a stream, as is\nstdout. Streams are readable, writable, or both. All streams are\ninstances of [EventEmitter][]\n\nYou can load the Stream base classes by doing `require('stream')`.\nThere are base classes provided for Readable streams, Writable\nstreams, Duplex streams, and Transform streams.\n\n## Compatibility\n\nIn earlier versions of Node, the Readable stream interface was\nsimpler, but also less powerful and less useful.\n\n* Rather than waiting for you to call the `read()` method, `'data'`\n events would start emitting immediately. If you needed to do some\n I/O to decide how to handle data, then you had to store the chunks\n in some kind of buffer so that they would not be lost.\n* The `pause()` method was advisory, rather than guaranteed. This\n meant that you still had to be prepared to receive `'data'` events\n even when the stream was in a paused state.\n\nIn Node v0.10, the Readable class described below was added. For\nbackwards compatibility with older Node programs, Readable streams\nswitch into \"old mode\" when a `'data'` event handler is added, or when\nthe `pause()` or `resume()` methods are called. The effect is that,\neven if you are not using the new `read()` method and `'readable'`\nevent, you no longer have to worry about losing `'data'` chunks.\n\nMost programs will continue to function normally. However, this\nintroduces an edge case in the following conditions:\n\n* No `'data'` event handler is added.\n* The `pause()` and `resume()` methods are never called.\n\nFor example, consider the following code:\n\n```javascript\n// WARNING! BROKEN!\nnet.createServer(function(socket) {\n\n // we add an 'end' method, but never consume the data\n socket.on('end', function() {\n // It will never get here.\n socket.end('I got your message (but didnt read it)\\n');\n });\n\n}).listen(1337);\n```\n\nIn versions of node prior to v0.10, the incoming message data would be\nsimply discarded. However, in Node v0.10 and beyond, the socket will\nremain paused forever.\n\nThe workaround in this situation is to call the `resume()` method to\ntrigger \"old mode\" behavior:\n\n```javascript\n// Workaround\nnet.createServer(function(socket) {\n\n socket.on('end', function() {\n socket.end('I got your message (but didnt read it)\\n');\n });\n\n // start the flow of data, discarding it.\n socket.resume();\n\n}).listen(1337);\n```\n\nIn addition to new Readable streams switching into old-mode, pre-v0.10\nstyle streams can be wrapped in a Readable class using the `wrap()`\nmethod.\n\n## Class: stream.Readable\n\n\n\nA `Readable Stream` has the following methods, members, and events.\n\nNote that `stream.Readable` is an abstract class designed to be\nextended with an underlying implementation of the `_read(size)`\nmethod. (See below.)\n\n### new stream.Readable([options])\n\n* `options` {Object}\n * `highWaterMark` {Number} The maximum number of bytes to store in\n the internal buffer before ceasing to read from the underlying\n resource. Default=16kb\n * `encoding` {String} If specified, then buffers will be decoded to\n strings using the specified encoding. Default=null\n * `objectMode` {Boolean} Whether this stream should behave\n as a stream of objects. Meaning that stream.read(n) returns\n a single value instead of a Buffer of size n\n\nIn classes that extend the Readable class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n### readable.\\_read(size)\n\n* `size` {Number} Number of bytes to read asynchronously\n\nNote: **This function should NOT be called directly.** It should be\nimplemented by child classes, and called by the internal Readable\nclass methods only.\n\nAll Readable stream implementations must provide a `_read` method\nto fetch data from the underlying resource.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\nWhen data is available, put it into the read queue by calling\n`readable.push(chunk)`. If `push` returns false, then you should stop\nreading. When `_read` is called again, you should start pushing more\ndata.\n\nThe `size` argument is advisory. Implementations where a \"read\" is a\nsingle call that returns data can use this to know how much data to\nfetch. Implementations where that is not relevant, such as TCP or\nTLS, may ignore this argument, and simply provide data whenever it\nbecomes available. There is no need, for example to \"wait\" until\n`size` bytes are available before calling `stream.push(chunk)`.\n\n### readable.push(chunk)\n\n* `chunk` {Buffer | null | String} Chunk of data to push into the read queue\n* return {Boolean} Whether or not more pushes should be performed\n\nNote: **This function should be called by Readable implementors, NOT\nby consumers of Readable subclasses.** The `_read()` function will not\nbe called again until at least one `push(chunk)` call is made. If no\ndata is available, then you MAY call `push('')` (an empty string) to\nallow a future `_read` call, without adding any data to the queue.\n\nThe `Readable` class works by putting data into a read queue to be\npulled out later by calling the `read()` method when the `'readable'`\nevent fires.\n\nThe `push()` method will explicitly insert some data into the read\nqueue. If it is called with `null` then it will signal the end of the\ndata.\n\nIn some cases, you may be wrapping a lower-level source which has some\nsort of pause/resume mechanism, and a data callback. In those cases,\nyou could wrap the low-level source object by doing something like\nthis:\n\n```javascript\n// source is an object with readStop() and readStart() methods,\n// and an `ondata` member that gets called when it has data, and\n// an `onend` member that gets called when the data is over.\n\nvar stream = new Readable();\n\nsource.ondata = function(chunk) {\n // if push() returns false, then we need to stop reading from source\n if (!stream.push(chunk))\n source.readStop();\n};\n\nsource.onend = function() {\n stream.push(null);\n};\n\n// _read will be called when the stream wants to pull more data in\n// the advisory size argument is ignored in this case.\nstream._read = function(n) {\n source.readStart();\n};\n```\n\n### readable.unshift(chunk)\n\n* `chunk` {Buffer | null | String} Chunk of data to unshift onto the read queue\n* return {Boolean} Whether or not more pushes should be performed\n\nThis is the corollary of `readable.push(chunk)`. Rather than putting\nthe data at the *end* of the read queue, it puts it at the *front* of\nthe read queue.\n\nThis is useful in certain use-cases where a stream is being consumed\nby a parser, which needs to \"un-consume\" some data that it has\noptimistically pulled out of the source.\n\n```javascript\n// A parser for a simple data protocol.\n// The \"header\" is a JSON object, followed by 2 \\n characters, and\n// then a message body.\n//\n// Note: This can be done more simply as a Transform stream. See below.\n\nfunction SimpleProtocol(source, options) {\n if (!(this instanceof SimpleProtocol))\n return new SimpleProtocol(options);\n\n Readable.call(this, options);\n this._inBody = false;\n this._sawFirstCr = false;\n\n // source is a readable stream, such as a socket or file\n this._source = source;\n\n var self = this;\n source.on('end', function() {\n self.push(null);\n });\n\n // give it a kick whenever the source is readable\n // read(0) will not consume any bytes\n source.on('readable', function() {\n self.read(0);\n });\n\n this._rawHeader = [];\n this.header = null;\n}\n\nSimpleProtocol.prototype = Object.create(\n Readable.prototype, { constructor: { value: SimpleProtocol }});\n\nSimpleProtocol.prototype._read = function(n) {\n if (!this._inBody) {\n var chunk = this._source.read();\n\n // if the source doesn't have data, we don't have data yet.\n if (chunk === null)\n return this.push('');\n\n // check if the chunk has a \\n\\n\n var split = -1;\n for (var i = 0; i < chunk.length; i++) {\n if (chunk[i] === 10) { // '\\n'\n if (this._sawFirstCr) {\n split = i;\n break;\n } else {\n this._sawFirstCr = true;\n }\n } else {\n this._sawFirstCr = false;\n }\n }\n\n if (split === -1) {\n // still waiting for the \\n\\n\n // stash the chunk, and try again.\n this._rawHeader.push(chunk);\n this.push('');\n } else {\n this._inBody = true;\n var h = chunk.slice(0, split);\n this._rawHeader.push(h);\n var header = Buffer.concat(this._rawHeader).toString();\n try {\n this.header = JSON.parse(header);\n } catch (er) {\n this.emit('error', new Error('invalid simple protocol data'));\n return;\n }\n // now, because we got some extra data, unshift the rest\n // back into the read queue so that our consumer will see it.\n var b = chunk.slice(split);\n this.unshift(b);\n\n // and let them know that we are done parsing the header.\n this.emit('header', this.header);\n }\n } else {\n // from there on, just provide the data to our consumer.\n // careful not to push(null), since that would indicate EOF.\n var chunk = this._source.read();\n if (chunk) this.push(chunk);\n }\n};\n\n// Usage:\nvar parser = new SimpleProtocol(source);\n// Now parser is a readable stream that will emit 'header'\n// with the parsed header data.\n```\n\n### readable.wrap(stream)\n\n* `stream` {Stream} An \"old style\" readable stream\n\nIf you are using an older Node library that emits `'data'` events and\nhas a `pause()` method that is advisory only, then you can use the\n`wrap()` method to create a Readable stream that uses the old stream\nas its data source.\n\nFor example:\n\n```javascript\nvar OldReader = require('./old-api-module.js').OldReader;\nvar oreader = new OldReader;\nvar Readable = require('stream').Readable;\nvar myReader = new Readable().wrap(oreader);\n\nmyReader.on('readable', function() {\n myReader.read(); // etc.\n});\n```\n\n### Event: 'readable'\n\nWhen there is data ready to be consumed, this event will fire.\n\nWhen this event emits, call the `read()` method to consume the data.\n\n### Event: 'end'\n\nEmitted when the stream has received an EOF (FIN in TCP terminology).\nIndicates that no more `'data'` events will happen. If the stream is\nalso writable, it may be possible to continue writing.\n\n### Event: 'data'\n\nThe `'data'` event emits either a `Buffer` (by default) or a string if\n`setEncoding()` was used.\n\nNote that adding a `'data'` event listener will switch the Readable\nstream into \"old mode\", where data is emitted as soon as it is\navailable, rather than waiting for you to call `read()` to consume it.\n\n### Event: 'error'\n\nEmitted if there was an error receiving data.\n\n### Event: 'close'\n\nEmitted when the underlying resource (for example, the backing file\ndescriptor) has been closed. Not all streams will emit this.\n\n### readable.setEncoding(encoding)\n\nMakes the `'data'` event emit a string instead of a `Buffer`. `encoding`\ncan be `'utf8'`, `'utf16le'` (`'ucs2'`), `'ascii'`, or `'hex'`.\n\nThe encoding can also be set by specifying an `encoding` field to the\nconstructor.\n\n### readable.read([size])\n\n* `size` {Number | null} Optional number of bytes to read.\n* Return: {Buffer | String | null}\n\nNote: **This function SHOULD be called by Readable stream users.**\n\nCall this method to consume data once the `'readable'` event is\nemitted.\n\nThe `size` argument will set a minimum number of bytes that you are\ninterested in. If not set, then the entire content of the internal\nbuffer is returned.\n\nIf there is no data to consume, or if there are fewer bytes in the\ninternal buffer than the `size` argument, then `null` is returned, and\na future `'readable'` event will be emitted when more is available.\n\nCalling `stream.read(0)` will always return `null`, and will trigger a\nrefresh of the internal buffer, but otherwise be a no-op.\n\n### readable.pipe(destination, [options])\n\n* `destination` {Writable Stream}\n* `options` {Object} Optional\n * `end` {Boolean} Default=true\n\nConnects this readable stream to `destination` WriteStream. Incoming\ndata on this stream gets written to `destination`. Properly manages\nback-pressure so that a slow destination will not be overwhelmed by a\nfast readable stream.\n\nThis function returns the `destination` stream.\n\nFor example, emulating the Unix `cat` command:\n\n process.stdin.pipe(process.stdout);\n\nBy default `end()` is called on the destination when the source stream\nemits `end`, so that `destination` is no longer writable. Pass `{ end:\nfalse }` as `options` to keep the destination stream open.\n\nThis keeps `writer` open so that \"Goodbye\" can be written at the\nend.\n\n reader.pipe(writer, { end: false });\n reader.on(\"end\", function() {\n writer.end(\"Goodbye\\n\");\n });\n\nNote that `process.stderr` and `process.stdout` are never closed until\nthe process exits, regardless of the specified options.\n\n### readable.unpipe([destination])\n\n* `destination` {Writable Stream} Optional\n\nUndo a previously established `pipe()`. If no destination is\nprovided, then all previously established pipes are removed.\n\n### readable.pause()\n\nSwitches the readable stream into \"old mode\", where data is emitted\nusing a `'data'` event rather than being buffered for consumption via\nthe `read()` method.\n\nCeases the flow of data. No `'data'` events are emitted while the\nstream is in a paused state.\n\n### readable.resume()\n\nSwitches the readable stream into \"old mode\", where data is emitted\nusing a `'data'` event rather than being buffered for consumption via\nthe `read()` method.\n\nResumes the incoming `'data'` events after a `pause()`.\n\n\n## Class: stream.Writable\n\n\n\nA `Writable` Stream has the following methods, members, and events.\n\nNote that `stream.Writable` is an abstract class designed to be\nextended with an underlying implementation of the\n`_write(chunk, encoding, cb)` method. (See below.)\n\n### new stream.Writable([options])\n\n* `options` {Object}\n * `highWaterMark` {Number} Buffer level when `write()` starts\n returning false. Default=16kb\n * `decodeStrings` {Boolean} Whether or not to decode strings into\n Buffers before passing them to `_write()`. Default=true\n\nIn classes that extend the Writable class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n### writable.\\_write(chunk, encoding, callback)\n\n* `chunk` {Buffer | String} The chunk to be written. Will always\n be a buffer unless the `decodeStrings` option was set to `false`.\n* `encoding` {String} If the chunk is a string, then this is the\n encoding type. Ignore chunk is a buffer. Note that chunk will\n **always** be a buffer unless the `decodeStrings` option is\n explicitly set to `false`.\n* `callback` {Function} Call this function (optionally with an error\n argument) when you are done processing the supplied chunk.\n\nAll Writable stream implementations must provide a `_write` method to\nsend data to the underlying resource.\n\nNote: **This function MUST NOT be called directly.** It should be\nimplemented by child classes, and called by the internal Writable\nclass methods only.\n\nCall the callback using the standard `callback(error)` pattern to\nsignal that the write completed successfully or with an error.\n\nIf the `decodeStrings` flag is set in the constructor options, then\n`chunk` may be a string rather than a Buffer, and `encoding` will\nindicate the sort of string that it is. This is to support\nimplementations that have an optimized handling for certain string\ndata encodings. If you do not explicitly set the `decodeStrings`\noption to `false`, then you can safely ignore the `encoding` argument,\nand assume that `chunk` will always be a Buffer.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\n\n### writable.write(chunk, [encoding], [callback])\n\n* `chunk` {Buffer | String} Data to be written\n* `encoding` {String} Optional. If `chunk` is a string, then encoding\n defaults to `'utf8'`\n* `callback` {Function} Optional. Called when this chunk is\n successfully written.\n* Returns {Boolean}\n\nWrites `chunk` to the stream. Returns `true` if the data has been\nflushed to the underlying resource. Returns `false` to indicate that\nthe buffer is full, and the data will be sent out in the future. The\n`'drain'` event will indicate when the buffer is empty again.\n\nThe specifics of when `write()` will return false, is determined by\nthe `highWaterMark` option provided to the constructor.\n\n### writable.end([chunk], [encoding], [callback])\n\n* `chunk` {Buffer | String} Optional final data to be written\n* `encoding` {String} Optional. If `chunk` is a string, then encoding\n defaults to `'utf8'`\n* `callback` {Function} Optional. Called when the final chunk is\n successfully written.\n\nCall this method to signal the end of the data being written to the\nstream.\n\n### Event: 'drain'\n\nEmitted when the stream's write queue empties and it's safe to write\nwithout buffering again. Listen for it when `stream.write()` returns\n`false`.\n\n### Event: 'close'\n\nEmitted when the underlying resource (for example, the backing file\ndescriptor) has been closed. Not all streams will emit this.\n\n### Event: 'finish'\n\nWhen `end()` is called and there are no more chunks to write, this\nevent is emitted.\n\n### Event: 'pipe'\n\n* `source` {Readable Stream}\n\nEmitted when the stream is passed to a readable stream's pipe method.\n\n### Event 'unpipe'\n\n* `source` {Readable Stream}\n\nEmitted when a previously established `pipe()` is removed using the\nsource Readable stream's `unpipe()` method.\n\n## Class: stream.Duplex\n\n\n\nA \"duplex\" stream is one that is both Readable and Writable, such as a\nTCP socket connection.\n\nNote that `stream.Duplex` is an abstract class designed to be\nextended with an underlying implementation of the `_read(size)`\nand `_write(chunk, encoding, callback)` methods as you would with a Readable or\nWritable stream class.\n\nSince JavaScript doesn't have multiple prototypal inheritance, this\nclass prototypally inherits from Readable, and then parasitically from\nWritable. It is thus up to the user to implement both the lowlevel\n`_read(n)` method as well as the lowlevel `_write(chunk, encoding, cb)` method\non extension duplex classes.\n\n### new stream.Duplex(options)\n\n* `options` {Object} Passed to both Writable and Readable\n constructors. Also has the following fields:\n * `allowHalfOpen` {Boolean} Default=true. If set to `false`, then\n the stream will automatically end the readable side when the\n writable side ends and vice versa.\n\nIn classes that extend the Duplex class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n## Class: stream.Transform\n\nA \"transform\" stream is a duplex stream where the output is causally\nconnected in some way to the input, such as a zlib stream or a crypto\nstream.\n\nThere is no requirement that the output be the same size as the input,\nthe same number of chunks, or arrive at the same time. For example, a\nHash stream will only ever have a single chunk of output which is\nprovided when the input is ended. A zlib stream will either produce\nmuch smaller or much larger than its input.\n\nRather than implement the `_read()` and `_write()` methods, Transform\nclasses must implement the `_transform()` method, and may optionally\nalso implement the `_flush()` method. (See below.)\n\n### new stream.Transform([options])\n\n* `options` {Object} Passed to both Writable and Readable\n constructors.\n\nIn classes that extend the Transform class, make sure to call the\nconstructor so that the buffering settings can be properly\ninitialized.\n\n### transform.\\_transform(chunk, encoding, callback)\n\n* `chunk` {Buffer | String} The chunk to be transformed. Will always\n be a buffer unless the `decodeStrings` option was set to `false`.\n* `encoding` {String} If the chunk is a string, then this is the\n encoding type. (Ignore if `decodeStrings` chunk is a buffer.)\n* `callback` {Function} Call this function (optionally with an error\n argument) when you are done processing the supplied chunk.\n\nNote: **This function MUST NOT be called directly.** It should be\nimplemented by child classes, and called by the internal Transform\nclass methods only.\n\nAll Transform stream implementations must provide a `_transform`\nmethod to accept input and produce output.\n\n`_transform` should do whatever has to be done in this specific\nTransform class, to handle the bytes being written, and pass them off\nto the readable portion of the interface. Do asynchronous I/O,\nprocess things, and so on.\n\nCall `transform.push(outputChunk)` 0 or more times to generate output\nfrom this input chunk, depending on how much data you want to output\nas a result of this chunk.\n\nCall the callback function only when the current chunk is completely\nconsumed. Note that there may or may not be output as a result of any\nparticular input chunk.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\n### transform.\\_flush(callback)\n\n* `callback` {Function} Call this function (optionally with an error\n argument) when you are done flushing any remaining data.\n\nNote: **This function MUST NOT be called directly.** It MAY be implemented\nby child classes, and if so, will be called by the internal Transform\nclass methods only.\n\nIn some cases, your transform operation may need to emit a bit more\ndata at the end of the stream. For example, a `Zlib` compression\nstream will store up some internal state so that it can optimally\ncompress the output. At the end, however, it needs to do the best it\ncan with what is left, so that the data will be complete.\n\nIn those cases, you can implement a `_flush` method, which will be\ncalled at the very end, after all the written data is consumed, but\nbefore emitting `end` to signal the end of the readable side. Just\nlike with `_transform`, call `transform.push(chunk)` zero or more\ntimes, as appropriate, and call `callback` when the flush operation is\ncomplete.\n\nThis method is prefixed with an underscore because it is internal to\nthe class that defines it, and should not be called directly by user\nprograms. However, you **are** expected to override this method in\nyour own extension classes.\n\n### Example: `SimpleProtocol` parser\n\nThe example above of a simple protocol parser can be implemented much\nmore simply by using the higher level `Transform` stream class.\n\nIn this example, rather than providing the input as an argument, it\nwould be piped into the parser, which is a more idiomatic Node stream\napproach.\n\n```javascript\nfunction SimpleProtocol(options) {\n if (!(this instanceof SimpleProtocol))\n return new SimpleProtocol(options);\n\n Transform.call(this, options);\n this._inBody = false;\n this._sawFirstCr = false;\n this._rawHeader = [];\n this.header = null;\n}\n\nSimpleProtocol.prototype = Object.create(\n Transform.prototype, { constructor: { value: SimpleProtocol }});\n\nSimpleProtocol.prototype._transform = function(chunk, encoding, done) {\n if (!this._inBody) {\n // check if the chunk has a \\n\\n\n var split = -1;\n for (var i = 0; i < chunk.length; i++) {\n if (chunk[i] === 10) { // '\\n'\n if (this._sawFirstCr) {\n split = i;\n break;\n } else {\n this._sawFirstCr = true;\n }\n } else {\n this._sawFirstCr = false;\n }\n }\n\n if (split === -1) {\n // still waiting for the \\n\\n\n // stash the chunk, and try again.\n this._rawHeader.push(chunk);\n } else {\n this._inBody = true;\n var h = chunk.slice(0, split);\n this._rawHeader.push(h);\n var header = Buffer.concat(this._rawHeader).toString();\n try {\n this.header = JSON.parse(header);\n } catch (er) {\n this.emit('error', new Error('invalid simple protocol data'));\n return;\n }\n // and let them know that we are done parsing the header.\n this.emit('header', this.header);\n\n // now, because we got some extra data, emit this first.\n this.push(b);\n }\n } else {\n // from there on, just provide the data to our consumer as-is.\n this.push(b);\n }\n done();\n};\n\nvar parser = new SimpleProtocol();\nsource.pipe(parser)\n\n// Now parser is a readable stream that will emit 'header'\n// with the parsed header data.\n```\n\n\n## Class: stream.PassThrough\n\nThis is a trivial implementation of a `Transform` stream that simply\npasses the input bytes across to the output. Its purpose is mainly\nfor examples and testing, but there are occasionally use cases where\nit can come in handy.\n\n\n[EventEmitter]: events.html#events_class_events_eventemitter\n", - "readmeFilename": "README.md", - "_id": "readable-stream@1.1.10", - "dist": { - "shasum": "a8f59a6db2bc499a3c78c241df717c2e6b035415" - }, - "_from": "readable-stream@~1.1.9", - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.10.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/passthrough.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/passthrough.js deleted file mode 100644 index 27e8d8a5..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/passthrough.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_passthrough.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/readable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/readable.js deleted file mode 100644 index 09b8bf50..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,7 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = require('stream'); -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/transform.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/transform.js deleted file mode 100644 index 5d482f07..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/transform.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_transform.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/writable.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/writable.js deleted file mode 100644 index e1e9efdf..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/writable.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_writable.js") diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/.npmignore deleted file mode 100644 index 07e6e472..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/README.md deleted file mode 100644 index 8d6a1928..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# stream-counter - -Keep track of how many bytes have been written to a stream. - -## Usage - -```js -var StreamCounter = require('stream-counter'); -var counter = new StreamCounter(); -counter.on('progress', function() { - console.log("progress", counter.bytes); -}); -fs.createReadStream('foo.txt').pipe(counter); -``` diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/index.js deleted file mode 100644 index c490c2db..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/index.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = ByteCounter; - -var Writable = require('readable-stream').Writable; -var util = require('util'); - -util.inherits(ByteCounter, Writable); -function ByteCounter(options) { - Writable.call(this, options); - this.bytes = 0; -} - -ByteCounter.prototype._write = function(chunk, encoding, cb) { - this.bytes += chunk.length; - this.emit('progress'); - cb(); -}; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/package.json deleted file mode 100644 index 7c1df3f4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "stream-counter", - "version": "0.2.0", - "description": "keeps track of how many bytes have been written to a stream", - "main": "index.js", - "scripts": { - "test": "node test/test.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/superjoe30/node-stream-counter.git" - }, - "author": { - "name": "Andrew Kelley", - "email": "superjoe30@gmail.com" - }, - "license": "BSD", - "engines": { - "node": ">=0.8.0" - }, - "dependencies": { - "readable-stream": "~1.1.8" - }, - "readme": "# stream-counter\n\nKeep track of how many bytes have been written to a stream.\n\n## Usage\n\n```js\nvar StreamCounter = require('stream-counter');\nvar counter = new StreamCounter();\ncounter.on('progress', function() {\n console.log(\"progress\", counter.bytes);\n});\nfs.createReadStream('foo.txt').pipe(counter);\n```\n", - "readmeFilename": "README.md", - "_id": "stream-counter@0.2.0", - "_from": "stream-counter@~0.2.0" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/test/test.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/test/test.js deleted file mode 100644 index 0da95660..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/test/test.js +++ /dev/null @@ -1,20 +0,0 @@ -var ByteCounter = require('../'); -var fs = require('fs'); -var path = require('path'); -var assert = require('assert'); - -var counter = new ByteCounter(); -var remainingTests = 2; -counter.once('progress', function() { - assert.strictEqual(counter.bytes, 5); - remainingTests -= 1; -}); -var is = fs.createReadStream(path.join(__dirname, 'test.txt')); -is.pipe(counter); -is.on('end', function() { - remainingTests -= 1; - assert.strictEqual(counter.bytes, 5); -}); -process.on('exit', function() { - assert.strictEqual(remainingTests, 0); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/test/test.txt b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/test/test.txt deleted file mode 100644 index 81c545ef..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/stream-counter/test/test.txt +++ /dev/null @@ -1 +0,0 @@ -1234 diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/package.json deleted file mode 100644 index 4eaf52bd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "multiparty", - "version": "2.2.0", - "description": "multipart/form-data parser which supports streaming", - "repository": { - "type": "git", - "url": "git@github.com:superjoe30/node-multiparty.git" - }, - "keywords": [ - "file", - "upload", - "formidable", - "stream", - "s3" - ], - "devDependencies": { - "findit": "0.1.1", - "hashish": "0.0.4", - "mocha": "~1.8.2", - "request": "~2.16.6", - "mkdirp": "~0.3.5", - "superagent": "~0.14.1" - }, - "scripts": { - "test": "ulimit -n 500 && mocha --timeout 4000 --reporter spec --recursive test/test.js" - }, - "engines": { - "node": ">=0.8.0" - }, - "license": "MIT", - "dependencies": { - "readable-stream": "~1.1.9", - "stream-counter": "~0.2.0" - }, - "readme": "[![Build Status](https://travis-ci.org/superjoe30/node-multiparty.png?branch=master)](https://travis-ci.org/superjoe30/node-multiparty)\n# multiparty\n\nParse http requests with content-type `multipart/form-data`, also known as file uploads.\n\nSee also [busboy](https://github.com/mscdex/busboy) - a\n[faster](https://github.com/mscdex/dicer/wiki/Benchmarks) alternative\nwhich may be worth looking into.\n\n### Why the fork?\n\n * This module uses the Node.js v0.10 streams properly, *even in Node.js v0.8*\n * It will not create a temp file for you unless you want it to.\n * Counts bytes and does math to help you figure out the `Content-Length` of\n each part.\n * You can easily stream uploads to s3 with\n [knox](https://github.com/LearnBoost/knox), for [example](examples/s3.js).\n * Less bugs. This code is simpler, has all deprecated functionality removed,\n has cleaner tests, and does not try to do anything beyond multipart stream\n parsing.\n\n## Installation\n\n```\nnpm install multiparty\n```\n\n## Usage\n\n * See [examples](examples).\n\nParse an incoming `multipart/form-data` request.\n\n```js\nvar multiparty = require('multiparty')\n , http = require('http')\n , util = require('util')\n\nhttp.createServer(function(req, res) {\n if (req.url === '/upload' && req.method === 'POST') {\n // parse a file upload\n var form = new multiparty.Form();\n\n form.parse(req, function(err, fields, files) {\n res.writeHead(200, {'content-type': 'text/plain'});\n res.write('received upload:\\n\\n');\n res.end(util.inspect({fields: fields, files: files}));\n });\n\n return;\n }\n\n // show a file upload form\n res.writeHead(200, {'content-type': 'text/html'});\n res.end(\n '
          '+\n '
          '+\n '
          '+\n ''+\n '
          '\n );\n}).listen(8080);\n```\n\n## API\n\n### multiparty.Form\n```js\nvar form = new multiparty.Form(options)\n```\nCreates a new form. Options:\n\n * `encoding` - sets encoding for the incoming form fields. Defaults to `utf8`.\n * `maxFieldSize` - Limits the amount of memory a field (not a file) can\n allocate in bytes. If this value is exceeded, an `error` event is emitted.\n The default size is 2MB.\n * `maxFields` - Limits the number of fields that will be parsed before\n emitting an `error` event. A file counts as a field in this case.\n Defaults to 1000.\n * `autoFields` - Enables `field` events. This is automatically set to `true`\n if you add a `field` listener.\n * `autoFiles` - Enables `file` events. This is automatically set to `true`\n if you add a `file` listener.\n * `uploadDir` - Only relevant when `autoFiles` is `true`. The directory for\n placing file uploads in. You can move them later using `fs.rename()`.\n Defaults to `os.tmpDir()`.\n * `hash` - Only relevant when `autoFiles` is `true`. If you want checksums\n calculated for incoming files, set this to either `sha1` or `md5`.\n Defaults to off.\n\n#### form.parse(request, [cb])\n\nParses an incoming node.js `request` containing form data. If `cb` is\nprovided, `autoFields` and `autoFiles` are set to `true` and all fields and\nfiles are collected and passed to the callback:\n\n```js\nform.parse(req, function(err, fieldsObject, filesObject, fieldsList, filesList) {\n // ...\n});\n```\n\nIt is often convenient to access a field or file by name. In this situation,\nuse `fieldsObject` or `filesObject`. However sometimes, as in the case of a\n`` the multipart stream will contain\nmultiple files of the same input name, and you are interested in all of them.\nIn this case, use `filesList`.\n\nAnother example is when you do not care what the field name of a file is; you\nare merely interested in a single upload. In this case, set `maxFields` to 1\n(assuming no other fields expected besides the file) and use `filesList[0]`.\n\n#### form.bytesReceived\n\nThe amount of bytes received for this form so far.\n\n#### form.bytesExpected\n\nThe expected number of bytes in this form.\n\n### Events\n\n#### 'error' (err)\n\nYou definitely want to handle this event. If not your server *will* crash when\nusers submit bogus multipart requests!\n\n#### 'part' (part)\n\nEmitted when a part is encountered in the request. `part` is a\n`ReadableStream`. It also has the following properties:\n\n * `headers` - the headers for this part. For example, you may be interested\n in `content-type`.\n * `name` - the field name for this part\n * `filename` - only if the part is an incoming file\n * `byteOffset` - the byte offset of this part in the request body\n * `byteCount` - assuming that this is the last part in the request,\n this is the size of this part in bytes. You could use this, for\n example, to set the `Content-Length` header if uploading to S3.\n If the part had a `Content-Length` header then that value is used\n here instead.\n\n#### 'aborted'\n\nEmitted when the request is aborted. This event will be followed shortly\nby an `error` event. In practice you do not need to handle this event.\n\n#### 'progress' (bytesReceived, bytesExpected)\n\n#### 'close'\n\nEmitted after all parts have been parsed and emitted. Not emitted if an `error`\nevent is emitted. This is typically when you would send your response.\n\n#### 'file' (name, file)\n\n**By default multiparty will not touch your hard drive.** But if you add this\nlistener, multiparty automatically sets `form.autoFiles` to `true` and will\nstream uploads to disk for you. \n\n * `name` - the field name for this file\n * `file` - an object with these properties:\n - `fieldName` - same as `name` - the field name for this file\n - `originalFilename` - the filename that the user reports for the file\n - `path` - the absolute path of the uploaded file on disk\n - `headers` - the HTTP headers that were sent along with this file\n - `size` - size of the file in bytes\n\nIf you set the `form.hash` option, then `file` will also contain a `hash`\nproperty which is the checksum of the file.\n\n#### 'field' (name, value)\n\n * `name` - field name\n * `value` - string field value\n\n", - "readmeFilename": "README.md", - "_id": "multiparty@2.2.0", - "dist": { - "shasum": "a7f2341196203083ed0367e4432332bbeb00dfc4" - }, - "_from": "multiparty@2.2.0", - "_resolved": "https://registry.npmjs.org/multiparty/-/multiparty-2.2.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/bench-multipart-parser.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/bench-multipart-parser.js deleted file mode 100644 index ee5dbad4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/bench-multipart-parser.js +++ /dev/null @@ -1,76 +0,0 @@ -var assert = require('assert') - , Form = require('../').Form - , boundary = '-----------------------------168072824752491622650073' - , mb = 100 - , buffer = createMultipartBuffer(boundary, mb * 1024 * 1024) - -var callbacks = { - partBegin: -1, - partEnd: -1, - headerField: -1, - headerValue: -1, - partData: -1, - end: -1, -}; - -var form = new Form({ boundary: boundary }); - -hijack('onParseHeaderField', function() { - callbacks.headerField++; -}); - -hijack('onParseHeaderValue', function() { - callbacks.headerValue++; -}); - -hijack('onParsePartBegin', function() { - callbacks.partBegin++; -}); - -hijack('onParsePartData', function() { - callbacks.partData++; -}); - -hijack('onParsePartEnd', function() { - callbacks.partEnd++; -}); - -form.on('finish', function() { - callbacks.end++; -}); - -var start = new Date(); -form.write(buffer, function(err) { - var duration = new Date() - start; - assert.ifError(err); - var mbPerSec = (mb / (duration / 1000)).toFixed(2); - console.log(mbPerSec+' mb/sec'); -}); - -process.on('exit', function() { - for (var k in callbacks) { - assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]); - } -}); - -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; -} - -function hijack(name, fn) { - var oldFn = form[name]; - form[name] = function() { - fn(); - return oldFn.apply(this, arguments); - }; -} - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/beta-sticker-1.png b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/beta-sticker-1.png deleted file mode 100644 index 20b1a7f1..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/beta-sticker-1.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/binaryfile.tar.gz b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/binaryfile.tar.gz deleted file mode 100644 index 4a85af7a..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/binaryfile.tar.gz and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/blank.gif b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/blank.gif deleted file mode 100644 index 75b945d2..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/blank.gif and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/funkyfilename.txt b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/funkyfilename.txt deleted file mode 100644 index e7a4785e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/funkyfilename.txt +++ /dev/null @@ -1 +0,0 @@ -I am a text file with a funky name! diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/menu_separator.png b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/menu_separator.png deleted file mode 100644 index 1c16a71e..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/menu_separator.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/pf1y5.png b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/pf1y5.png deleted file mode 100644 index 44d60175..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/pf1y5.png and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/plain.txt b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/plain.txt deleted file mode 100644 index 9b6903e2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/file/plain.txt +++ /dev/null @@ -1 +0,0 @@ -I am a plain text file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/beta-sticker-1.png.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/beta-sticker-1.png.http deleted file mode 100644 index 833b83ca..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/beta-sticker-1.png.http +++ /dev/null @@ -1,12 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Length: 2483 - ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Disposition: form-data; name="sticker"; filename="beta-sticker-1.png" -Content-Type: image/png -Content-Transfer-Encoding: base64 - -iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABh5JREFUeNrMmHtIHEcYwGfv5SNwaovxEanEiJKqlYCCTRo1f0SvDeof1legEcE/YttQaNOiaQjYFFtpKaJILZU8SCRUWqlJGpoWepGLTXqUEnzFxCrnK9DEelbvvPOe/WacuY7r7HmGFjrwsbNzt7u//V7zfYvQ/2xI/9K1/NyvMP9PgCTuGmmL6/0ckD9UOGmbIExUsqMkAPHJjv5QwKRtgKioqDlh5+w/7IFeCuLlxCeA2zQ0IcCwh2qoaLH09fUdTElJ2e/1elU+n0/y+9fvPz4+fvfYsWN3YOoBcXPiocLghD4mBYHhQTCErqWlZU9FRcXJqKiowyqVSk/uSEH4o8fjWVlYWDB2d3e3d3R0WGB5jYqLg/NyGgsKxMNgkDB4451NTU3vxcXF1SlBKB0tFsuVxsbGjlu3bj2GJQeIk8K5RVBqBTMxrYRfuHAh9/jx4+ejo6MPS9I6f6hHPOC6rOLi4vyVlZXf7t27Z5c5/iZfkgMxxyUwFy9ezC0tLe3V6XRJ/MOCAYjWwsLCni0oKCh98uSJaWhoyMZFn0/uT2qBqYi/1NbWxjc0NJwPFUYExc/B53R5eXk5ZrN5YH5+3slFn5+D2uBDzG90IJETExOtzGdC9RelNf78wYMH3xQWFn4Ep0sgyyCr1NmJP6kEIa5tbW3dEx8fXxeKRoJpT76OR3p6enllZWUKTCOwNalFAglWDkTCvLq6+uR2YYKZSw4GQVKNfZQCafjkqhKYTBsTE3NY/uYi2Q4MP5KTkw9QGB3VEMv6G/YioqFLly5lazQavfytxobnUW+PWTGisIyNPEL3QYLB4PPIyMi4EydO7JUBbTIZ0RDYOFPkE8t/OdHczCK6Y/qdzP8BfUTW8Tj/uQndvT1F5vOzVvTLz1PwX4cQbt++fekURsNpSNLIw16v1z/HLsRRgecsSnovm8nxs5bvUe+NN1Bz47fkfBaAXj2aA2BWEsM/3hhFX1/5Fe3NTEAfvn8NXTO+tSH68IiNjU2Qw/AmCzg2XCQp+YyhJAu9c+pl9GJ+KmhiEt38bhjpoyJQRtYudA60k3dwD6o4mouKjmSiolcy0ArRqnXz3rT+knwFEShhNKLNlmmFP7Kf8XxuehHpj0QQmLdPGch/ioYyCSAe57pMaHnJgcprctDdwUkRjKi8CUTWhipvbm7uvlJo3zFNoHJDOznPeGEXqn+9EBUf+AQZXvqU+BEG/KCpHz2flYh+ALO9++ZX5L/Mj3gfevjw4ZRoP+PzD/b4HadPn844c+aMkb0F1DqIz9byzBvquXytvr6+7vr16+Ow9CfN2njjdfFAWpo9o2FnNmm12kQMw24gcvSnhbHb7Y+huHsNlhapLNHSxK3idlq287qhhrkKlSByOBzIZrPhGyCn04ncbjfRGAMV5ZlQxvDw8E+yYi1Q3qpleYjUQlNTU5aysrJqgNBhIAwGVSDCkFj48BVFULA1eCl7XV3dx1CKYK3YqKnY7u9Ti2royclJ76FDh1YhxefgsoFpCIOtra0RuGBQwYbRaLzc1dVlpjA2ZiqmKbWsDAmEYU9Pz8Tg4OCNoqKixNTU1BQostDq6iqBcrlcRBiYfEff1KBR+OnpabPBYOikWlnhtOOWm0zUffpnZ2ednZ2dJtCYMTs7+xkA2x0eHk6gsMYwFPYr/EC1Wo2LMEWzWa1WC1QRZ8FUVgpj42ohD3umWqHjRFxf5RkZGVkCNQ9CcTWQn5+flpSUtBOiMKAt7Fek/FSAmpmZMVdVVZ0dGxv7g4PhteMVlbBIofv0sh4Lbmhtb2+/Cbv1eFpaWmJCQsJODMO0hGGgUghAAay9v7//i5KSki9lmmG+4+Jg/MHaIH6f0dCkqaNFFc5VkViam5v319TUNEDdvRubEGsNYHGqsAwMDFxta2u7DdpdpA+3c+LgWiHfVkCiFnpDw0iLqwgqO6BVKoPo00K6WIDsOzE6OrpE395FzeLgxMn5jVe0dYTa26s5jfFg4VR0nAuwNtrFda1rgmToD6VzVWq3eTPyYAxOwwH5gvT2PiWY7X4fUgJTywp1fivyyL6E+Lb6XvQ0X9AkBeeXZED+p/k+9LcAAwAXm3hBLzoZPAAAAABJRU5ErkJggg== ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/binaryfile.tar.gz.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/binaryfile.tar.gz.http deleted file mode 100644 index 4f4fadb0..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/binaryfile.tar.gz.http +++ /dev/null @@ -1,12 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Length: 676 - ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Disposition: form-data; name="file"; filename="binaryfile.tar.gz" -Content-Type: application/x-gzip -Content-Transfer-Encoding: base64 - -H4sIAGiNIU8AA+3R0W6CMBQGYK59iobLZantRDG73osUOGqnFNJWM2N897UghG1ZdmWWLf93U/jP4bRAq8q92hJ/dY1J7kQEqyyLq8yXYrp2ltkqkTKXYiEykYc++ZTLVcLEvQ40dXReWcYSV1pdnL/v+6n+R11mjKVG1ZQ+s3TT2FpXqjhQ+hjzE1mnGxNLkgu+7tOKWjIVmVKTC6XL9ZaeXj4VQhwKWzL+cI4zwgQuuhkh3mhTad/Hkssh3im3027X54JnQ360R/M19OT8kC7SEN7Ooi2VvrEfznHQRWzl83gxttZKmzGehzPRW/+W8X+3fvL8sFet9sS6m3EIma02071MU3Uf9KHrmV1/+y8DAAAAAAAAAAAAAAAAAAAAAMB/9A6txIuJACgAAA== ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/blank.gif.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/blank.gif.http deleted file mode 100644 index 7426f5b6..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/blank.gif.http +++ /dev/null @@ -1,12 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Length: 323 - ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Disposition: form-data; name="file"; filename="blank.gif" -Content-Type: image/gif -Content-Transfer-Encoding: base64 - -R0lGODlhAQABAJH/AP///wAAAMDAwAAAACH5BAEAAAIALAAAAAABAAEAAAICVAEAOw== ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/menu_seperator.png.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/menu_seperator.png.http deleted file mode 100644 index d08fd37e..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/menu_seperator.png.http +++ /dev/null @@ -1,12 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Length: 1509 - ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -Content-Disposition: form-data; name="image"; filename="menu_separator.png" -Content-Type: image/png -Content-Transfer-Encoding: base64 - -iVBORw0KGgoAAAANSUhEUgAAAAIAAAAYCAIAAABfmbuOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDcxODNBNzJERDcyMTFFMUFBOEVFNDQzOTA0MDJDMjQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDcxODNBNzNERDcyMTFFMUFBOEVFNDQzOTA0MDJDMjQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowNzE4M0E3MERENzIxMUUxQUE4RUU0NDM5MDQwMkMyNCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowNzE4M0E3MURENzIxMUUxQUE4RUU0NDM5MDQwMkMyNCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pmvhbb8AAAAXSURBVHjaYnHk9PON8WJiAIPBSwEEGAAPrgG+VozFWgAAAABJRU5ErkJggg== ---\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/pf1y5.png.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/pf1y5.png.http deleted file mode 100644 index 20c2c2df..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/pf1y5.png.http and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/plain.txt.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/plain.txt.http deleted file mode 100644 index 5e85ad6b..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/encoding/plain.txt.http +++ /dev/null @@ -1,13 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----TLV0SrKD4z1TRxRhAPUvZ -Content-Length: 221 - -------TLV0SrKD4z1TRxRhAPUvZ -Content-Disposition: form-data; name="file"; filename="plain.txt" -Content-Type: text/plain -Content-Transfer-Encoding: 7bit - -I am a plain text file - -------TLV0SrKD4z1TRxRhAPUvZ-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/no-filename/filename-name.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/no-filename/filename-name.http deleted file mode 100644 index 43672a32..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/no-filename/filename-name.http +++ /dev/null @@ -1,13 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----WebKitFormBoundarytyE4wkKlZ5CQJVTG -Content-Length: 1000 - -------WebKitFormBoundarytyE4wkKlZ5CQJVTG -Content-Disposition: form-data; filename="plain.txt"; name="upload" -Content-Type: text/plain - -I am a plain text file - -------WebKitFormBoundarytyE4wkKlZ5CQJVTG-- - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/no-filename/generic.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/no-filename/generic.http deleted file mode 100644 index e0dee27c..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/no-filename/generic.http +++ /dev/null @@ -1,13 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----WebKitFormBoundarytyE4wkKlZ5CQJVTG -Content-Length: 1000 - -------WebKitFormBoundarytyE4wkKlZ5CQJVTG -Content-Disposition: form-data; name="upload"; filename="" -Content-Type: text/plain - -I am a plain text file - -------WebKitFormBoundarytyE4wkKlZ5CQJVTG-- - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/preamble/crlf.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/preamble/crlf.http deleted file mode 100644 index 1d5f7095..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/preamble/crlf.http +++ /dev/null @@ -1,13 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----TLV0SrKD4z1TRxRhAPUvZ -Content-Length: 184 - - -------TLV0SrKD4z1TRxRhAPUvZ -Content-Disposition: form-data; name="upload"; filename="plain.txt" -Content-Type: text/plain - -I am a plain text file - -------TLV0SrKD4z1TRxRhAPUvZ-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/preamble/preamble.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/preamble/preamble.http deleted file mode 100644 index d14d4330..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/preamble/preamble.http +++ /dev/null @@ -1,13 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----TLV0SrKD4z1TRxRhAPUvZ -Content-Length: 226 - -This is a preamble which should be ignored -------TLV0SrKD4z1TRxRhAPUvZ -Content-Disposition: form-data; name="upload"; filename="plain.txt" -Content-Type: text/plain - -I am a plain text file - -------TLV0SrKD4z1TRxRhAPUvZ-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/info.md b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/info.md deleted file mode 100644 index 3c9dbe3d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-chrome-13.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-chrome-13.http deleted file mode 100644 index 4ef39172..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +++ /dev/null @@ -1,26 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Connection: keep-alive -Referer: http://localhost:8080/ -Content-Length: 383 -Cache-Control: max-age=0 -Origin: http://localhost:8080 -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1 -Content-Type: multipart/form-data; boundary=----WebKitFormBoundarytyE4wkKlZ5CQJVTG -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -Cookie: jqCookieJar_tablesorter=%7B%22showListTable%22%3A%5B%5B5%2C1%5D%2C%5B1%2C0%5D%5D%7D - -------WebKitFormBoundarytyE4wkKlZ5CQJVTG -Content-Disposition: form-data; name="title" - -Weird filename -------WebKitFormBoundarytyE4wkKlZ5CQJVTG -Content-Disposition: form-data; name="upload"; filename=": \ ? % * | %22 < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: text/plain - -I am a text file with a funky name! - -------WebKitFormBoundarytyE4wkKlZ5CQJVTG-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http deleted file mode 100644 index bf49f85f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +++ /dev/null @@ -1,24 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -Accept-Language: en-us,en;q=0.5 -Accept-Encoding: gzip,deflate -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 -Keep-Alive: 115 -Connection: keep-alive -Referer: http://localhost:8080/ -Content-Type: multipart/form-data; boundary=---------------------------9849436581144108930470211272 -Content-Length: 438 - ------------------------------9849436581144108930470211272 -Content-Disposition: form-data; name="title" - -Weird filename ------------------------------9849436581144108930470211272 -Content-Disposition: form-data; name="upload"; filename=": \ ? % * | " < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: text/plain - -I am a text file with a funky name! - ------------------------------9849436581144108930470211272-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-safari-5.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-safari-5.http deleted file mode 100644 index ff158a43..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/osx-safari-5.http +++ /dev/null @@ -1,23 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Origin: http://localhost:8080 -Content-Length: 383 -User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1 -Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryQJZ1gvhvdgfisJPJ -Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 -Referer: http://localhost:8080/ -Accept-Language: en-us -Accept-Encoding: gzip, deflate -Connection: keep-alive - -------WebKitFormBoundaryQJZ1gvhvdgfisJPJ -Content-Disposition: form-data; name="title" - -Weird filename -------WebKitFormBoundaryQJZ1gvhvdgfisJPJ -Content-Disposition: form-data; name="upload"; filename=": \ ? % * | %22 < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: text/plain - -I am a text file with a funky name! - -------WebKitFormBoundaryQJZ1gvhvdgfisJPJ-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-chrome-12.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-chrome-12.http deleted file mode 100644 index f0fc533a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +++ /dev/null @@ -1,24 +0,0 @@ -POST /upload HTTP/1.1 -Host: 192.168.56.1:8080 -Connection: keep-alive -Referer: http://192.168.56.1:8080/ -Content-Length: 344 -Cache-Control: max-age=0 -Origin: http://192.168.56.1:8080 -User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30 -Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryEvqBNplR3ByrwQPa -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 - -------WebKitFormBoundaryEvqBNplR3ByrwQPa -Content-Disposition: form-data; name="title" - -Weird filename -------WebKitFormBoundaryEvqBNplR3ByrwQPa -Content-Disposition: form-data; name="upload"; filename=" ? % * | %22 < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: text/plain - - -------WebKitFormBoundaryEvqBNplR3ByrwQPa-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-ie-7.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-ie-7.http deleted file mode 100644 index 2e2c61c7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-ie-7.http +++ /dev/null @@ -1,22 +0,0 @@ -POST /upload HTTP/1.1 -Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, */* -Referer: http://192.168.56.1:8080/ -Accept-Language: de -User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) -Content-Type: multipart/form-data; boundary=---------------------------7db1fe232017c -Accept-Encoding: gzip, deflate -Host: 192.168.56.1:8080 -Content-Length: 368 -Connection: Keep-Alive -Cache-Control: no-cache - ------------------------------7db1fe232017c -Content-Disposition: form-data; name="title" - -Weird filename ------------------------------7db1fe232017c -Content-Disposition: form-data; name="upload"; filename=" ? % * | " < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: application/octet-stream - - ------------------------------7db1fe232017c-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-ie-8.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-ie-8.http deleted file mode 100644 index e2b94fae..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-ie-8.http +++ /dev/null @@ -1,22 +0,0 @@ -POST /upload HTTP/1.1 -Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, */* -Referer: http://192.168.56.1:8080/ -Accept-Language: de -User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0) -Content-Type: multipart/form-data; boundary=---------------------------7db3a8372017c -Accept-Encoding: gzip, deflate -Host: 192.168.56.1:8080 -Content-Length: 368 -Connection: Keep-Alive -Cache-Control: no-cache - ------------------------------7db3a8372017c -Content-Disposition: form-data; name="title" - -Weird filename ------------------------------7db3a8372017c -Content-Disposition: form-data; name="upload"; filename=" ? % * | " < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: application/octet-stream - - ------------------------------7db3a8372017c-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-safari-5.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-safari-5.http deleted file mode 100644 index 6379ac01..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/special-chars-in-filename/xp-safari-5.http +++ /dev/null @@ -1,22 +0,0 @@ -POST /upload HTTP/1.1 -Host: 192.168.56.1:8080 -Referer: http://192.168.56.1:8080/ -Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 -Accept-Language: en-US -Origin: http://192.168.56.1:8080 -User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4 -Accept-Encoding: gzip, deflate -Content-Type: multipart/form-data; boundary=----WebKitFormBoundarykmaWSUbu697WN9TM -Content-Length: 344 -Connection: keep-alive - -------WebKitFormBoundarykmaWSUbu697WN9TM -Content-Disposition: form-data; name="title" - -Weird filename -------WebKitFormBoundarykmaWSUbu697WN9TM -Content-Disposition: form-data; name="upload"; filename=" ? % * | %22 < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt" -Content-Type: text/plain - - -------WebKitFormBoundarykmaWSUbu697WN9TM-- diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/workarounds/missing-hyphens1.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/workarounds/missing-hyphens1.http deleted file mode 100644 index 28268903..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/workarounds/missing-hyphens1.http +++ /dev/null @@ -1,12 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----TLV0SrKD4z1TRxRhAPUvZ -Content-Length: 178 - -------TLV0SrKD4z1TRxRhAPUvZ -Content-Disposition: form-data; name="upload"; filename="plain.txt" -Content-Type: text/plain - -I am a plain text file - -------TLV0SrKD4z1TRxRhAPUvZ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/workarounds/missing-hyphens2.http b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/workarounds/missing-hyphens2.http deleted file mode 100644 index 8e181947..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/http/workarounds/missing-hyphens2.http +++ /dev/null @@ -1,12 +0,0 @@ -POST /upload HTTP/1.1 -Host: localhost:8080 -Content-Type: multipart/form-data; boundary=----TLV0SrKD4z1TRxRhAPUvZ -Content-Length: 180 - -------TLV0SrKD4z1TRxRhAPUvZ -Content-Disposition: form-data; name="upload"; filename="plain.txt" -Content-Type: text/plain - -I am a plain text file - -------TLV0SrKD4z1TRxRhAPUvZ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/encoding.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/encoding.js deleted file mode 100644 index 1ade9656..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/encoding.js +++ /dev/null @@ -1,69 +0,0 @@ -module.exports['menu_seperator.png.http'] = [ - { - type: 'file', - name: 'image', - filename: 'menu_separator.png', - fixture: 'menu_separator.png', - sha1: 'c845ca3ea794be298f2a1b79769b71939eaf4e54', - size: 931, - } -]; - -module.exports['beta-sticker-1.png.http'] = [ - { - type: 'file', - name: 'sticker', - filename: 'beta-sticker-1.png', - fixture: 'beta-sticker-1.png', - sha1: '6abbcffd12b4ada5a6a084fe9e4584f846331bc4', - size: 1660, - } -]; - -module.exports['blank.gif.http'] = [ - { - type: 'file', - name: 'file', - filename: 'blank.gif', - fixture: 'blank.gif', - sha1: 'a1fdee122b95748d81cee426d717c05b5174fe96', - size: 49, - } -]; - -module.exports['binaryfile.tar.gz.http'] = [ - { - type: 'file', - name: 'file', - filename: 'binaryfile.tar.gz', - fixture: 'binaryfile.tar.gz', - sha1: 'cfabe13b348e5e69287d677860880c52a69d2155', - size: 301, - } -]; - -module.exports['plain.txt.http'] = [ - { - type: 'file', - name: 'file', - filename: 'plain.txt', - fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872', - size: 23, - } -]; - -module.exports['pf1y5.png.http'] = [ - { - type: 'field', - name: 'path', - }, - { - type: 'file', - name: 'upload', - filename: 'pf1y5.png', - fixture: 'pf1y5.png', - sha1: '805cc640c5b182e86f2b5c8ebf34ecf063cd34fd', - size: 768323, - } -]; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/no-filename.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/no-filename.js deleted file mode 100644 index f03b4f01..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/no-filename.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports['generic.http'] = [ - {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}, -]; - -module.exports['filename-name.http'] = [ - {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}, -]; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/preamble.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/preamble.js deleted file mode 100644 index d2e4cfdb..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/preamble.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports['crlf.http'] = [ - {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}, -]; - -module.exports['preamble.http'] = [ - {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}, -]; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/special-chars-in-filename.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/special-chars-in-filename.js deleted file mode 100644 index aa0b79f3..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/special-chars-in-filename.js +++ /dev/null @@ -1,30 +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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/workarounds.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/workarounds.js deleted file mode 100644 index e59c5b26..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/js/workarounds.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports['missing-hyphens1.http'] = [ - {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}, -]; -module.exports['missing-hyphens2.http'] = [ - {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt', - sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}, -]; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/multi_video.upload b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/multi_video.upload deleted file mode 100644 index 9c82ba36..00000000 Binary files a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/multi_video.upload and /dev/null differ diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/multipart.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/fixture/multipart.js deleted file mode 100644 index a4761699..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/record.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/record.js deleted file mode 100644 index 9f1cef86..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/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( - '
          '+ - '
          '+ - '
          '+ - ''+ - '
          ' - ); - }); -}); - -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/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-connection-aborted.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-connection-aborted.js deleted file mode 100644 index bd83e1d6..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-connection-aborted.js +++ /dev/null @@ -1,27 +0,0 @@ -var assert = require('assert'); -var http = require('http'); -var net = require('net'); -var multiparty = require('../../'); - -var server = http.createServer(function (req, res) { - var form = new multiparty.Form(); - var aborted_received = false; - form.on('aborted', function () { - aborted_received = true; - }); - form.on('error', function () { - assert(aborted_received, 'Error event should follow aborted'); - server.close(); - }); - form.on('end', function () { - throw new Error('Unexpected "end" event'); - }); - form.parse(req); -}).listen(0, 'localhost', function () { - var client = net.connect(server.address().port); - client.write( - "POST / HTTP/1.1\r\n" + - "Content-Length: 70\r\n" + - "Content-Type: multipart/form-data; boundary=foo\r\n\r\n"); - client.end(); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-content-transfer-encoding.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-content-transfer-encoding.js deleted file mode 100644 index 35e5a1f8..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-content-transfer-encoding.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') - , multiparty = require('../../') - , http = require('http') - , path = require('path') - , TMP_PATH = path.join(__dirname, '..', 'tmp') - -var server = http.createServer(function(req, res) { - var form = new multiparty.Form(); - form.uploadDir = TMP_PATH; - form.on('close', function () { - throw new Error('Unexpected "close" event'); - }); - form.on('end', function () { - throw new Error('Unexpected "end" event'); - }); - form.on('error', function (e) { - res.writeHead(500); - res.end(e.message); - }); - form.parse(req); -}); - -server.listen(0, function() { - var body = - '--foo\r\n' + - 'Content-Disposition: form-data; name="file1"; filename="file1"\r\n' + - 'Content-Type: application/octet-stream\r\n' + - '\r\nThis is the first file\r\n' + - '--foo\r\n' + - 'Content-Type: application/octet-stream\r\n' + - 'Content-Disposition: form-data; name="file2"; filename="file2"\r\n' + - 'Content-Transfer-Encoding: unknown\r\n' + - '\r\nThis is the second file\r\n' + - '--foo--\r\n'; - - var req = http.request({ - method: 'POST', - port: server.address().port, - headers: { - 'Content-Length': body.length, - 'Content-Type': 'multipart/form-data; boundary=foo' - } - }); - req.on('response', function (res) { - assert.equal(res.statusCode, 500); - res.on('data', function () {}); - res.on('end', function () { - server.close(); - }); - }); - req.end(body); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-invalid.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-invalid.js deleted file mode 100644 index ede541da..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-invalid.js +++ /dev/null @@ -1,35 +0,0 @@ -var superagent = require('superagent') - , multiparty = require('../../') - , http = require('http') - -var server = http.createServer(function(req, resp) { - var form = new multiparty.Form(); - - var errCount = 0; - form.on('error', function(err) { - errCount += 1; - resp.end(); - }); - form.on('file', function(name, file) { - }); - form.on('field', function(name, file) { - }); - - form.parse(req); -}); -server.listen(function() { - var url = 'http://localhost:' + server.address().port + '/' - var req = superagent.post(url) - req.set('Content-Type', 'multipart/form-data; boundary=foo') - req.write('--foo\r\n') - req.write('Content-filename="foo.txt"\r\n') - req.write('\r\n') - req.write('some text here') - req.write('Content-Disposition: form-data; name="text"; filename="bar.txt"\r\n') - req.write('\r\n') - req.write('some more text stuff') - req.write('\r\n--foo--') - req.end(function(err, resp) { - server.close(); - }); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-15.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-15.js deleted file mode 100644 index 43982fa7..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-15.js +++ /dev/null @@ -1,88 +0,0 @@ -var http = require('http') - , multiparty = require('../../') - , assert = require('assert') - , superagent = require('superagent') - , path = require('path') - -var server = http.createServer(function(req, res) { - assert.strictEqual(req.url, '/upload'); - assert.strictEqual(req.method, 'POST'); - - var form = new multiparty.Form({autoFields:true,autoFiles:true}); - - form.on('error', function(err) { - console.log(err); - }); - - form.on('close', function() { - }); - - var fileCount = 0; - form.on('file', function(name, file) { - fileCount += 1; - }); - - form.parse(req, function(err, fields, files) { - var objFileCount = 0; - for (var file in files) { - objFileCount += 1; - } - // multiparty does NOT try to do intelligent things based on - // the part name. - assert.strictEqual(fileCount, 2); - assert.strictEqual(objFileCount, 1); - res.end(); - }); -}); -server.listen(function() { - var url = 'http://localhost:' + server.address().port + '/upload'; - var req = superagent.post(url); - req.attach('files[]', fixture('pf1y5.png'), 'SOG2.JPG'); - req.attach('files[]', fixture('binaryfile.tar.gz'), 'BenF364_LIB353.zip'); - - // Get the existing boundary. - var contentType = req.get('content-type'); - var split = contentType.split(' '); - - // Set the content-type. - req.set('content-type', split.join('')); - - req.end(function(err, resp) { - assert.ifError(err); - resp.on('end', function() { - server.close(); - }); - }); - - // No space. - createRequest(''); - - // Single space. - createRequest(' '); - - // Multiple spaces. - createRequest(' '); -}); - -function createRequest(separator) { - var url = 'http://localhost:' + server.address().port + '/upload'; - var req = superagent.post(url); - req.attach('files[]', fixture('pf1y5.png'), 'SOG2.JPG'); - req.attach('files[]', fixture('binaryfile.tar.gz'), 'BenF364_LIB353.zip'); - - // Get the existing boundary. - var contentType = req.get('content-type'); - var split = contentType.split(' '); - - // Set the content-type. - req.set('content-type', split.join(separator)); - - req.end(function(err, resp) { - assert.ifError(err); - // We don't close the server, to allow other requests to pass. - }); -} - -function fixture(name) { - return path.join(__dirname, '..', 'fixture', 'file', name) -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-19.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-19.js deleted file mode 100644 index d7da0cfb..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-19.js +++ /dev/null @@ -1,44 +0,0 @@ -var assert = require('assert'); -var http = require('http'); -var net = require('net'); -var multiparty = require('../../'); - -var client; -var server = http.createServer(function (req, res) { - var form = new multiparty.Form({maxFields: 1}); - form.on('aborted', function () { - throw new Error("did not expect aborted"); - }); - var first = true; - form.on('error', function (err) { - assert.ok(first); - first = false; - client.end(); - assert.ok(/maxFields/.test(err.message)); - server.close(); - }); - form.on('end', function () { - throw new Error('Unexpected "end" event'); - }); - form.parse(req); -}); -server.listen(function() { - client = net.connect(server.address().port); - - client.write("POST /upload HTTP/1.1\r\n" + - "Content-Length: 728\r\n" + - "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"title\"\r\n" + - "\r\n" + - "foofoo" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"upload\"; filename=\"blah1.txt\"\r\n" + - "Content-Type: text/plain\r\n" + - "\r\n" + - "hi1\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n"); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-21.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-21.js deleted file mode 100644 index 155fba05..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-21.js +++ /dev/null @@ -1,66 +0,0 @@ -var assert = require('assert'); -var http = require('http'); -var net = require('net'); -var multiparty = require('../../'); - -var client; -var server = http.createServer(function(req, res) { - var form = new multiparty.Form(); - - form.parse(req, function(err, fieldsTable, filesTable, fieldsList, filesList) { - if (err) { - console.error(err.stack); - return; - } - assert.strictEqual(fieldsList.length, 1); - assert.strictEqual(fieldsList[0].name, "title"); - assert.strictEqual(fieldsList[0].value, "foofoo"); - assert.strictEqual(filesList.length, 4); - assert.strictEqual(filesList[0].fieldName, "upload"); - assert.strictEqual(filesList[1].fieldName, "upload"); - assert.strictEqual(filesList[2].fieldName, "upload"); - assert.strictEqual(filesList[3].fieldName, "upload"); - res.end(); - client.end(); - server.close(); - }); -}); -server.listen(function() { - client = net.connect(server.address().port); - - client.write("POST /upload HTTP/1.1\r\n" + - "Content-Length: 728\r\n" + - "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"title\"\r\n" + - "\r\n" + - "foofoo" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"upload\"; filename=\"blah1.txt\"\r\n" + - "Content-Type: text/plain\r\n" + - "\r\n" + - "hi1\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"upload\"; filename=\"blah2.txt\"\r\n" + - "Content-Type: text/plain\r\n" + - "\r\n" + - "hi2\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"upload\"; filename=\"blah3.txt\"\r\n" + - "Content-Type: text/plain\r\n" + - "\r\n" + - "hi3\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "Content-Disposition: form-data; name=\"upload\"; filename=\"blah4.txt\"\r\n" + - "Content-Type: text/plain\r\n" + - "\r\n" + - "hi4\r\n" + - "\r\n" + - "------WebKitFormBoundaryvfUZhxgsZDO7FXLF--\r\n" - ); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-4.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-4.js deleted file mode 100644 index 66b2a690..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-4.js +++ /dev/null @@ -1,51 +0,0 @@ -var http = require('http') - , multiparty = require('../../') - , assert = require('assert') - , superagent = require('superagent') - , path = require('path') - -var server = http.createServer(function(req, res) { - assert.strictEqual(req.url, '/upload'); - assert.strictEqual(req.method, 'POST'); - - var form = new multiparty.Form({autoFields:true,autoFiles:true}); - - form.on('error', function(err) { - console.log(err); - }); - - form.on('close', function() { - }); - - var fileCount = 0; - form.on('file', function(name, file) { - fileCount += 1; - }); - - form.parse(req, function(err, fields, files) { - var objFileCount = 0; - for (var file in files) { - objFileCount += 1; - } - // multiparty does NOT try to do intelligent things based on - // the part name. - assert.strictEqual(fileCount, 2); - assert.strictEqual(objFileCount, 1); - res.end(); - }); -}); -server.listen(function() { - var url = 'http://localhost:' + server.address().port + '/upload'; - var req = superagent.post(url); - req.attach('files[]', fixture('pf1y5.png'), 'SOG2.JPG'); - req.attach('files[]', fixture('binaryfile.tar.gz'), 'BenF364_LIB353.zip'); - req.end(function(err, resp) { - assert.ifError(err); - resp.on('end', function() { - server.close(); - }); - }); -}); -function fixture(name) { - return path.join(__dirname, '..', 'fixture', 'file', name) -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-46.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-46.js deleted file mode 100644 index 676b8709..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-46.js +++ /dev/null @@ -1,49 +0,0 @@ -var http = require('http'), - multiparty = require('../../'), - request = require('request'), - assert = require('assert'); - -var host = 'localhost'; - -var index = [ - '
          ', - ' ', - ' ', - '
          ' -].join("\n"); - -var server = http.createServer(function(req, res) { - - // Show a form for testing purposes. - if (req.method === 'GET') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end(index); - return; - } - - // Parse form and write results to response. - var form = new multiparty.Form(); - form.parse(req, function(err, fields, files) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.write(JSON.stringify({err: err, fields: fields, files: files})); - res.end(); - }); - -}).listen(0, host, function() { - - //console.log("Server up and running..."); - - var server = this, - url = 'http://' + host + ':' + server.address().port; - - var parts = [ - {'Content-Disposition': 'form-data; name="foo"', 'body': 'bar'} - ] - - var req = request({method: 'POST', url: url, multipart: parts}, function(e, res, body) { - var obj = JSON.parse(body); - assert.equal("bar", obj.fields.foo); - server.close(); - }); - -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-5.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-5.js deleted file mode 100644 index 80eadf20..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/standalone/test-issue-5.js +++ /dev/null @@ -1,39 +0,0 @@ -var assert = require('assert'); -var http = require('http'); -var net = require('net'); -var multiparty = require('../../'); - -var client; -var attachmentCount = 510; -var server = http.createServer(function(req, res) { - var form = new multiparty.Form({maxFields: 10000}); - - form.parse(req, function(err, fieldsTable, filesTable, fieldsList, filesList) { - assert.strictEqual(err.code, "EMFILE"); - res.end(); - client.end(); - server.close(); - }); -}); -server.listen(function() { - client = net.connect(server.address().port); - - var boundary = "------WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n"; - var oneAttachment = boundary + - "Content-Disposition: form-data; name=\"upload\"; filename=\"blah1.txt\"\r\n" + - "Content-Type: text/plain\r\n" + - "\r\n" + - "hi1\r\n" + - "\r\n"; - var payloadSize = oneAttachment.length * attachmentCount + boundary.length; - - client.write("POST /upload HTTP/1.1\r\n" + - "Content-Length: " + payloadSize + "\r\n" + - "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryvfUZhxgsZDO7FXLF\r\n" + - "\r\n"); - - for (var i = 0; i < attachmentCount; i += 1) { - client.write(oneAttachment); - } - client.write(boundary); -}); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/test.js b/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/test.js deleted file mode 100644 index 199d5cdd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/multiparty/test/test.js +++ /dev/null @@ -1,117 +0,0 @@ -var spawn = require('child_process').spawn - , findit = require('findit') - , path = require('path') - , hashish = require('hashish') - , fs = require('fs') - , http = require('http') - , net = require('net') - , assert = require('assert') - , multiparty = require('../') - , mkdirp = require('mkdirp') - , STANDALONE_PATH = path.join(__dirname, 'standalone') - , server = http.createServer() - , PORT = 13532 - , FIXTURE_PATH = path.join(__dirname, 'fixture') - , TMP_PATH = path.join(__dirname, 'tmp') - -mkdirp.sync(TMP_PATH); - -describe("fixtures", function() { - before(function(done) { - server.listen(PORT, done); - }); - var fixtures = []; - findit - .sync(path.join(FIXTURE_PATH, 'js')) - .forEach(function(jsPath) { - if (!/\.js$/.test(jsPath)) return; - var group = path.basename(jsPath, '.js'); - hashish.forEach(require(jsPath), function(fixture, name) { - it(group + '/' + name, createTest({ - name : group + '/' + name, - fixture : fixture, - })); - }); - }); -}); - -describe("standalone", function() { - findit - .sync(STANDALONE_PATH) - .forEach(function(jsPath) { - if (!/\.js$/.test(jsPath)) return; - it(path.basename(jsPath, '.js'), function(done) { - var child = spawn(process.execPath, [jsPath], { stdio: 'inherit' }); - child.on('error', function(err) { - done(err); - }); - child.on('exit', function(code) { - if (code) return done(new Error("exited with code " + code)); - done(); - }); - }); - }); -}); - -function createTest(fixture) { - var name = fixture.name; - fixture = fixture.fixture; - return function(done) { - uploadFixture(name, function(err, parts) { - if (err) return done(err); - fixture.forEach(function(expectedPart, i) { - var parsedPart = parts[i]; - assert.equal(parsedPart.type, expectedPart.type); - assert.equal(parsedPart.name, expectedPart.name); - - if (parsedPart.type === 'file') { - var file = parsedPart.value; - assert.equal(file.originalFilename, expectedPart.filename); - if(expectedPart.sha1) assert.strictEqual(file.hash, expectedPart.sha1); - if(expectedPart.size) assert.strictEqual(file.size, expectedPart.size); - } - }); - done(); - }); - }; - -} - -function uploadFixture(name, cb) { - server.once('request', function(req, res) { - var parts = []; - var form = new multiparty.Form({ - autoFields: true, - autoFiles: true, - }); - form.uploadDir = TMP_PATH; - form.hash = "sha1"; - - form.on('error', callback); - form.on('file', function(name, value) { - parts.push({type: 'file', name: name, value: value}); - }); - form.on('field', function(name, value) { - parts.push({type: 'field', name: name, value: value}); - }); - form.on('close', function() { - res.end('OK'); - callback(null, parts); - }); - form.parse(req); - - function callback() { - var realCallback = cb; - cb = function() {}; - realCallback.apply(null, arguments); - } - }); - - var socket = net.createConnection(PORT); - var file = fs.createReadStream(FIXTURE_PATH + '/http/' + name); - - file.pipe(socket, {end: false}); - socket.on('data', function () { - socket.end(); - }); -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/LICENSE deleted file mode 100644 index 42ca2e7d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Original "Negotiator" program Copyright Federico Romero -Port to JavaScript Copyright Isaac Z. Schlueter - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/accept.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/accept.js deleted file mode 100644 index 2a180391..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/accept.js +++ /dev/null @@ -1,47 +0,0 @@ -(function() { - var Negotiator, availableMediaTypes, http, key, representations, server, val; - - Negotiator = require('../lib/negotiator').Negotiator; - - http = require('http'); - - representations = { - 'text/html': '

          Hello world!

          ', - 'text/plain': 'Hello World!', - 'application/json': JSON.stringify({ - hello: 'world!' - }) - }; - - availableMediaTypes = (function() { - var _results; - _results = []; - for (key in representations) { - val = representations[key]; - _results.push(key); - } - return _results; - })(); - - server = http.createServer(function(req, res) { - var mediaType, negotiator; - negotiator = new Negotiator(req); - console.log("Accept: " + req.headers['accept']); - console.log("Preferred: " + (negotiator.preferredMediaTypes())); - console.log("Possible: " + (negotiator.preferredMediaTypes(availableMediaTypes))); - mediaType = negotiator.preferredMediaType(availableMediaTypes); - console.log("Selected: " + mediaType); - if (mediaType) { - res.writeHead(200, { - 'Content-Type': mediaType - }); - return res.end(representations[mediaType]); - } else { - res.writeHead(406); - return res.end(); - } - }); - - server.listen(8080); - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/charset.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/charset.js deleted file mode 100644 index 6455effa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/charset.js +++ /dev/null @@ -1,52 +0,0 @@ -(function() { - var Buffer, Iconv, Negotiator, availableCharsets, http, iconv, key, message, messages, server, val; - - Negotiator = require('../lib/negotiator').Negotiator; - - http = require('http'); - - Buffer = require('buffer').Buffer; - - Iconv = require('iconv').Iconv; - - iconv = new Iconv('UTF-8', 'ISO-8859-1'); - - message = "ë"; - - messages = { - 'utf-8': message, - 'iso-8859-1': iconv.convert(new Buffer(message)) - }; - - availableCharsets = (function() { - var _results; - _results = []; - for (key in messages) { - val = messages[key]; - _results.push(key); - } - return _results; - })(); - - server = http.createServer(function(req, res) { - var charset, negotiator; - negotiator = new Negotiator(req); - console.log("Accept-Charset: " + req.headers['accept-charset']); - console.log("Preferred: " + (negotiator.preferredCharsets())); - console.log("Possible: " + (negotiator.preferredCharsets(availableCharsets))); - charset = negotiator.preferredCharset(availableCharsets); - console.log("Selected: " + charset); - if (charset) { - res.writeHead(200, { - 'Content-Type': "text/html; charset=" + charset - }); - return res.end(messages[charset]); - } else { - res.writeHead(406); - return res.end(); - } - }); - - server.listen(8080); - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/encoding.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/encoding.js deleted file mode 100644 index a02d0f46..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/encoding.js +++ /dev/null @@ -1,48 +0,0 @@ -(function() { - var Negotiator, gbuf, http, messages; - - Negotiator = require('../lib/negotiator').Negotiator; - - http = require('http'); - - gbuf = require('gzip-buffer'); - - messages = { - identity: 'Hello World' - }; - - gbuf.gzip(messages.identity, function(zipped) { - var availableEncodings, key, server, val; - messages.gzip = zipped; - availableEncodings = (function() { - var _results; - _results = []; - for (key in messages) { - val = messages[key]; - _results.push(key); - } - return _results; - })(); - console.log(availableEncodings); - server = http.createServer(function(req, res) { - var encoding, negotiator; - negotiator = new Negotiator(req); - console.log("Accept-Encoding: " + req.headers['accept-encoding']); - console.log("Preferred: " + (negotiator.preferredEncodings())); - console.log("Possible: " + (negotiator.preferredEncodings(availableEncodings))); - encoding = negotiator.preferredEncoding(availableEncodings); - console.log("Selected: " + encoding); - if (encoding) { - res.writeHead(200, { - 'Content-Encoding': encoding - }); - return res.end(messages[encoding]); - } else { - res.writeHead(406); - return res.end(); - } - }); - return server.listen(8080); - }); - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/language.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/language.js deleted file mode 100644 index f161743f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/examples/language.js +++ /dev/null @@ -1,44 +0,0 @@ -(function() { - var Negotiator, availableLanguages, http, key, messages, server, val; - - Negotiator = require('../lib/negotiator').Negotiator; - - http = require('http'); - - messages = { - es: "¡Hola Mundo!", - en: "Hello World!" - }; - - availableLanguages = (function() { - var _results; - _results = []; - for (key in messages) { - val = messages[key]; - _results.push(key); - } - return _results; - })(); - - server = http.createServer(function(req, res) { - var language, negotiator; - negotiator = new Negotiator(req); - console.log("Accept-Language: " + req.headers['accept-language']); - console.log("Preferred: " + (negotiator.preferredLanguages())); - console.log("Possible: " + (negotiator.preferredLanguages(availableLanguages))); - language = negotiator.preferredLanguage(availableLanguages); - console.log("Selected: " + language); - if (language) { - res.writeHead(200, { - 'Content-Language': language - }); - return res.end(messages[language]); - } else { - res.writeHead(406); - return res.end(); - } - }); - - server.listen(8080); - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/charset.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/charset.js deleted file mode 100644 index 33004572..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/charset.js +++ /dev/null @@ -1,71 +0,0 @@ -module.exports = preferredCharsets; -preferredCharsets.preferredCharsets = preferredCharsets; - -function parseAcceptCharset(accept) { - return accept.split(',').map(function(e) { - return parseCharset(e.trim()); - }).filter(function(e) { - return e && e.q > 0; - }); -} - -function parseCharset(s) { - var match = s.match(/^\s*(\S+?)\s*(?:;(.*))?$/); - if (!match) return null; - - var charset = match[1]; - var q = 1; - if (match[2]) { - var params = match[2].split(';') - for (var i = 0; i < params.length; i ++) { - var p = params[i].trim().split('='); - if (p[0] === 'q') { - q = parseFloat(p[1]); - break; - } - } - } - - return { - charset: charset, - q: q - }; -} - -function getCharsetPriority(charset, accepted) { - return (accepted.filter(function(a) { - return specify(charset, a); - }).sort(function (a, b) { - // revsort - return a.q === b.q ? 0 : a.q > b.q ? -1 : 1; - })[0] || {q:0}).q; -} - -function specify(charset, spec) { - if (spec.charset === '*' || spec.charset === charset) { - return spec; - } -}; - -function preferredCharsets(accept, provided) { - accept = parseAcceptCharset(accept || ''); - if (provided) { - return provided.map(function(type) { - return [type, getCharsetPriority(type, accept)]; - }).filter(function(pair) { - return pair[1] > 0; - }).sort(function(a, b) { - // revsort - return a[1] === b[1] ? 0 : a[1] > b[1] ? -1 : 1; - }).map(function(pair) { - return pair[0]; - }); - } else { - return accept.sort(function (a, b) { - // revsort - return a.q < b.q ? 1 : -1; - }).map(function(type) { - return type.charset; - }); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/encoding.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/encoding.js deleted file mode 100644 index b4fc889f..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/encoding.js +++ /dev/null @@ -1,89 +0,0 @@ -module.exports = preferredEncodings; -preferredEncodings.preferredEncodings = preferredEncodings; - -function parseAcceptEncoding(accept) { - var acceptableEncodings; - - if (accept) { - acceptableEncodings = accept.split(',').map(function(e) { - return parseEncoding(e.trim()); - }); - } else { - acceptableEncodings = []; - } - - if (!acceptableEncodings.some(function(e) { - return e && e.encoding === 'identity'; - })) { - acceptableEncodings.push({ - encoding: 'identity', - q: 0.1 - }); - } - - return acceptableEncodings.filter(function(e) { - return e && e.q > 0; - }); -} - -function parseEncoding(s) { - var match = s.match(/^\s*(\S+?)\s*(?:;(.*))?$/); - - if (!match) return null; - - var encoding = match[1]; - var q = 1; - if (match[2]) { - var params = match[2].split(';'); - for (var i = 0; i < params.length; i ++) { - var p = params[i].trim().split('='); - if (p[0] === 'q') { - q = parseFloat(p[1]); - break; - } - } - } - - return { - encoding: encoding, - q: q - }; -} - -function getEncodingPriority(encoding, accepted) { - return (accepted.filter(function(a) { - return specify(encoding, a); - }).sort(function (a, b) { - // revsort - return a.q === b.q ? 0 : a.q > b.q ? -1 : 1; - })[0] || {q:0}).q; -} - -function specify(encoding, spec) { - if (spec.encoding === '*' || spec.encoding === encoding) { - return spec; - } -} - -function preferredEncodings(accept, provided) { - accept = parseAcceptEncoding(accept || ''); - if (provided) { - return provided.map(function(type) { - return [type, getEncodingPriority(type, accept)]; - }).filter(function(pair) { - return pair[1] > 0; - }).sort(function(a, b) { - // revsort - return a[1] === b[1] ? 0 : a[1] > b[1] ? -1 : 1; - }).map(function(pair) { - return pair[0]; - }); - } else { - return accept.sort(function (a, b) { - // revsort - return a.q < b.q ? 1 : -1; - }).map(function(type) { - return type.encoding; - }); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/language.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/language.js deleted file mode 100644 index 432b7026..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/language.js +++ /dev/null @@ -1,92 +0,0 @@ -module.exports = preferredLanguages; -preferredLanguages.preferredLanguages = preferredLanguages; - -function parseAcceptLanguage(accept) { - return accept.split(',').map(function(e) { - return parseLanguage(e.trim()); - }).filter(function(e) { - return e && e.q > 0; - }); -} - -function parseLanguage(s) { - var match = s.match(/^\s*(\S+?)(?:-(\S+?))?\s*(?:;(.*))?$/); - if (!match) return null; - - var prefix = match[1], - suffix = match[2], - full = prefix; - - if (suffix) full += "-" + suffix; - - var q = 1; - if (match[3]) { - var params = match[3].split(';') - for (var i = 0; i < params.length; i ++) { - var p = params[i].split('='); - if (p[0] === 'q') q = parseFloat(p[1]); - } - } - - return { - prefix: prefix, - suffix: suffix, - q: q, - full: full - }; -} - -function getLanguagePriority(language, accepted) { - var match = getClosestMatch(language, accepted); - return match ? match.q : 0; -} - -function getClosestMatch(language, accepted) { - var parsed = parseLanguage(language); - - var matches = accepted.filter(function(a) { - return a.full === parsed.full; - }); - if (matches.length) return matches[0]; - - matches = accepted.filter(function(a) { - return a.prefix === parsed.prefix && !a.suffix; - }); - if (matches.length) return matches[0]; - - matches = accepted.filter(function(a) { - return a.prefix === parsed.prefix; - }); - if (matches.length) return matches[0]; - - matches = accepted.filter(function(a) { - return a.prefix === '*'; - }); - return matches[0]; -} - -function preferredLanguages(accept, provided) { - accept = parseAcceptLanguage(accept || ''); - if (provided) { - - var ret = provided.map(function(type) { - return [type, getLanguagePriority(type, accept)]; - }).filter(function(pair) { - return pair[1] > 0; - }).sort(function(a, b) { - // revsort - return a[1] === b[1] ? 0 : a[1] > b[1] ? -1 : 1; - }).map(function(pair) { - return pair[0]; - }); - return ret; - - } else { - return accept.sort(function (a, b) { - // revsort - return a.q < b.q ? 1 : -1; - }).map(function(type) { - return type.full; - }); - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/mediaType.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/mediaType.js deleted file mode 100644 index 3dc017fd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/mediaType.js +++ /dev/null @@ -1,101 +0,0 @@ -module.exports = preferredMediaTypes; -preferredMediaTypes.preferredMediaTypes = preferredMediaTypes; - -function parseAccept(accept) { - return accept.split(',').map(function(e) { - return parseMediaType(e.trim()); - }).filter(function(e) { - return e && e.q > 0; - }); -}; - -function parseMediaType(s) { - var match = s.match(/\s*(\S+)\/([^;\s]+)\s*(?:;(.*))?/); - if (!match) return null; - - var type = match[1], - subtype = match[2], - full = "" + type + "/" + subtype, - params = {}, - q = 1; - - if (match[3]) { - params = match[3].split(';').map(function(s) { - return s.trim().split('='); - }).reduce(function (set, p) { - set[p[0]] = p[1]; - return set - }, params); - - if (params.q != null) { - q = parseFloat(params.q); - delete params.q; - } - } - - return { - type: type, - subtype: subtype, - params: params, - q: q, - full: full - }; -} - -function getMediaTypePriority(type, accepted) { - return (accepted.filter(function(a) { - return specify(type, a); - }).sort(function (a, b) { - // revsort - return a.q > b.q ? -1 : 1; - })[0] || {q:0}).q; -} - -function specifies(spec, type) { - return spec === '*' || spec === type; -} - -function specify(type, spec) { - var p = parseMediaType(type); - - if (spec.params) { - var keys = Object.keys(spec.params); - if (keys.some(function (k) { - return !specifies(spec.params[k], p.params[k]); - })) { - // some didn't specify. - return null; - } - } - - if (specifies(spec.type, p.type) && - specifies(spec.subtype, p.subtype)) { - return spec; - } -} - -function preferredMediaTypes(accept, provided) { - accept = parseAccept(accept || ''); - if (provided) { - return provided.map(function(type) { - return [type, getMediaTypePriority(type, accept)]; - }).filter(function(pair) { - return pair[1] > 0; - }).sort(function(a, b) { - // revsort - return a[1] === b[1] ? 0 : a[1] > b[1] ? -1 : 1; - }).map(function(pair) { - return pair[0]; - }); - - } else { - return accept.sort(function (a, b) { - // revsort - return a.q < b.q ? 1 : -1; - }).map(function(type) { - return type.full; - }); - } -} - - diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/negotiator.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/negotiator.js deleted file mode 100644 index fe0e58a5..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/lib/negotiator.js +++ /dev/null @@ -1,29 +0,0 @@ -module.exports = Negotiator; -Negotiator.Negotiator = Negotiator; - -function Negotiator(request) { - if (!(this instanceof Negotiator)) return new Negotiator(request); - this.request = request; -} - -var set = { preferredCharset: [require('./charset.js'), 'accept-charset'], - preferredEncoding: [require('./encoding.js'), 'accept-encoding'], - preferredLanguage: [require('./language.js'), 'accept-language'], - preferredMediaType: [require('./mediaType.js'), 'accept'] }; - -Object.keys(set).forEach(function (k) { - var mh = set[k], - method = mh[0], - header = mh[1], - singular = k, - plural = k + 's'; - - Negotiator.prototype[plural] = function (available) { - return method(this.request.headers[header], available); - }; - - Negotiator.prototype[singular] = function(available) { - var set = this[plural](available); - if (set) return set[0]; - }; -}) diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/package.json deleted file mode 100644 index 0a10415b..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "negotiator", - "description": "HTTP content negotiation", - "version": "0.3.0", - "author": { - "name": "Federico Romero", - "email": "federico.romero@outboxlabs.com" - }, - "contributors": [ - { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/federomero/negotiator.git" - }, - "keywords": [ - "http", - "content negotiation", - "accept", - "accept-language", - "accept-encoding", - "accept-charset" - ], - "engine": "node >= 0.6", - "license": "MIT", - "devDependencies": { - "nodeunit": "0.6.x" - }, - "scripts": { - "test": "nodeunit test" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "main": "lib/negotiator.js", - "readme": "# Negotiator\n\nAn HTTP content negotiator for node.js written in javascript.\n\n# Accept Negotiation\n\n Negotiator = require('negotiator')\n\n availableMediaTypes = ['text/html', 'text/plain', 'application/json']\n\n // The negotiator constructor receives a request object\n negotiator = new Negotiator(request)\n\n // Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'\n\n negotiator.preferredMediaTypes()\n // -> ['text/html', 'image/jpeg', 'application/*']\n\n negotiator.preferredMediaTypes(availableMediaTypes)\n // -> ['text/html', 'application/json']\n\n negotiator.preferredMediaType(availableMediaTypes)\n // -> 'text/html'\n\nYou can check a working example at `examples/accept.js`.\n\n## Methods\n\n`preferredMediaTypes(availableMediaTypes)`:\n\nReturns an array of preferred media types ordered by priority from a list of available media types.\n\n`preferredMediaType(availableMediaType)`:\n\nReturns the top preferred media type from a list of available media types.\n\n# Accept-Language Negotiation\n\n Negotiator = require('negotiator')\n\n negotiator = new Negotiator(request)\n\n availableLanguages = 'en', 'es', 'fr'\n\n // Let's say Accept-Language header is 'en;q=0.8, es, pt'\n\n negotiator.preferredLanguages()\n // -> ['es', 'pt', 'en']\n\n negotiator.preferredLanguages(availableLanguages)\n // -> ['es', 'en']\n\n language = negotiator.preferredLanguage(availableLanguages)\n // -> 'es'\n\nYou can check a working example at `examples/language.js`.\n\n## Methods\n\n`preferredLanguages(availableLanguages)`:\n\nReturns an array of preferred languages ordered by priority from a list of available languages.\n\n`preferredLanguage(availableLanguages)`:\n\nReturns the top preferred language from a list of available languages.\n\n# Accept-Charset Negotiation\n\n Negotiator = require('negotiator')\n\n availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']\n\n negotiator = new Negotiator(request)\n\n // Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'\n\n negotiator.preferredCharsets()\n // -> ['utf-8', 'iso-8859-1', 'utf-7']\n\n negotiator.preferredCharsets(availableCharsets)\n // -> ['utf-8', 'iso-8859-1']\n\n negotiator.preferredCharset(availableCharsets)\n // -> 'utf-8'\n\nYou can check a working example at `examples/charset.js`.\n\n## Methods\n\n`preferredCharsets(availableCharsets)`:\n\nReturns an array of preferred charsets ordered by priority from a list of available charsets.\n\n`preferredCharset(availableCharsets)`:\n\nReturns the top preferred charset from a list of available charsets.\n\n# Accept-Encoding Negotiation\n\n Negotiator = require('negotiator').Negotiator\n\n availableEncodings = ['identity', 'gzip']\n\n negotiator = new Negotiator(request)\n\n // Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'\n\n negotiator.preferredEncodings()\n // -> ['gzip', 'identity', 'compress']\n\n negotiator.preferredEncodings(availableEncodings)\n // -> ['gzip', 'identity']\n\n negotiator.preferredEncoding(availableEncodings)\n // -> 'gzip'\n\nYou can check a working example at `examples/encoding.js`.\n\n## Methods\n\n`preferredEncodings(availableEncodings)`:\n\nReturns an array of preferred encodings ordered by priority from a list of available encodings.\n\n`preferredEncoding(availableEncodings)`:\n\nReturns the top preferred encoding from a list of available encodings.\n\n# License\n\nMIT\n", - "readmeFilename": "readme.md", - "_id": "negotiator@0.3.0", - "dependencies": {}, - "dist": { - "shasum": "9fc159fef4b4d854d4a9559fe80ee4bf919304ae" - }, - "_from": "negotiator@0.3.0", - "_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.3.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/readme.md b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/readme.md deleted file mode 100644 index 0a077bbe..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/readme.md +++ /dev/null @@ -1,132 +0,0 @@ -# Negotiator - -An HTTP content negotiator for node.js written in javascript. - -# Accept Negotiation - - Negotiator = require('negotiator') - - availableMediaTypes = ['text/html', 'text/plain', 'application/json'] - - // The negotiator constructor receives a request object - negotiator = new Negotiator(request) - - // Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8' - - negotiator.preferredMediaTypes() - // -> ['text/html', 'image/jpeg', 'application/*'] - - negotiator.preferredMediaTypes(availableMediaTypes) - // -> ['text/html', 'application/json'] - - negotiator.preferredMediaType(availableMediaTypes) - // -> 'text/html' - -You can check a working example at `examples/accept.js`. - -## Methods - -`preferredMediaTypes(availableMediaTypes)`: - -Returns an array of preferred media types ordered by priority from a list of available media types. - -`preferredMediaType(availableMediaType)`: - -Returns the top preferred media type from a list of available media types. - -# Accept-Language Negotiation - - Negotiator = require('negotiator') - - negotiator = new Negotiator(request) - - availableLanguages = 'en', 'es', 'fr' - - // Let's say Accept-Language header is 'en;q=0.8, es, pt' - - negotiator.preferredLanguages() - // -> ['es', 'pt', 'en'] - - negotiator.preferredLanguages(availableLanguages) - // -> ['es', 'en'] - - language = negotiator.preferredLanguage(availableLanguages) - // -> 'es' - -You can check a working example at `examples/language.js`. - -## Methods - -`preferredLanguages(availableLanguages)`: - -Returns an array of preferred languages ordered by priority from a list of available languages. - -`preferredLanguage(availableLanguages)`: - -Returns the top preferred language from a list of available languages. - -# Accept-Charset Negotiation - - Negotiator = require('negotiator') - - availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5'] - - negotiator = new Negotiator(request) - - // Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2' - - negotiator.preferredCharsets() - // -> ['utf-8', 'iso-8859-1', 'utf-7'] - - negotiator.preferredCharsets(availableCharsets) - // -> ['utf-8', 'iso-8859-1'] - - negotiator.preferredCharset(availableCharsets) - // -> 'utf-8' - -You can check a working example at `examples/charset.js`. - -## Methods - -`preferredCharsets(availableCharsets)`: - -Returns an array of preferred charsets ordered by priority from a list of available charsets. - -`preferredCharset(availableCharsets)`: - -Returns the top preferred charset from a list of available charsets. - -# Accept-Encoding Negotiation - - Negotiator = require('negotiator').Negotiator - - availableEncodings = ['identity', 'gzip'] - - negotiator = new Negotiator(request) - - // Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5' - - negotiator.preferredEncodings() - // -> ['gzip', 'identity', 'compress'] - - negotiator.preferredEncodings(availableEncodings) - // -> ['gzip', 'identity'] - - negotiator.preferredEncoding(availableEncodings) - // -> 'gzip' - -You can check a working example at `examples/encoding.js`. - -## Methods - -`preferredEncodings(availableEncodings)`: - -Returns an array of preferred encodings ordered by priority from a list of available encodings. - -`preferredEncoding(availableEncodings)`: - -Returns the top preferred encoding from a list of available encodings. - -# License - -MIT diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/charset.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/charset.js deleted file mode 100644 index 79224a75..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/charset.js +++ /dev/null @@ -1,62 +0,0 @@ -(function() { - var configuration, preferredCharsets, testConfigurations, testCorrectCharset, _i, _len, - _this = this; - - preferredCharsets = require('../lib/charset').preferredCharsets; - - this["Should not return a charset when no charset is provided"] = function(test) { - test.deepEqual(preferredCharsets('*', []), []); - return test.done(); - }; - - this["Should not return a charset when no charset is acceptable"] = function(test) { - test.deepEqual(preferredCharsets('ISO-8859-1', ['utf-8']), []); - return test.done(); - }; - - this["Should not return a charset with q = 0"] = function(test) { - test.deepEqual(preferredCharsets('utf-8;q=0', ['utf-8']), []); - return test.done(); - }; - - testCorrectCharset = function(c) { - return _this["Should return " + c.selected + " for accept-charset header " + c.accept + " with provided charset " + c.provided] = function(test) { - test.deepEqual(preferredCharsets(c.accept, c.provided), c.selected); - return test.done(); - }; - }; - - testConfigurations = [ - { - accept: 'utf-8', - provided: ['utf-8'], - selected: ['utf-8'] - }, { - accept: '*', - provided: ['utf-8'], - selected: ['utf-8'] - }, { - accept: 'utf-8', - provided: ['utf-8', 'ISO-8859-1'], - selected: ['utf-8'] - }, { - accept: 'utf-8, ISO-8859-1', - provided: ['utf-8'], - selected: ['utf-8'] - }, { - accept: 'utf-8;q=0.8, ISO-8859-1', - provided: ['utf-8', 'ISO-8859-1'], - selected: ['ISO-8859-1', 'utf-8'] - }, { - accept: 'utf-8;q=0.8, ISO-8859-1', - provided: null, - selected: ['ISO-8859-1', 'utf-8'] - } - ]; - - for (_i = 0, _len = testConfigurations.length; _i < _len; _i++) { - configuration = testConfigurations[_i]; - testCorrectCharset(configuration); - } - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/encoding.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/encoding.js deleted file mode 100644 index 7859d5e4..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/encoding.js +++ /dev/null @@ -1,70 +0,0 @@ -(function() { - var configuration, preferredEncodings, testConfigurations, testCorrectEncoding, _i, _len, - _this = this; - - preferredEncodings = require('../lib/encoding').preferredEncodings; - - this["Should return identity encoding when no encoding is provided"] = function(test) { - test.deepEqual(preferredEncodings(null), ['identity']); - return test.done(); - }; - - this["Should include the identity encoding even if not explicity listed"] = function(test) { - test.ok(preferredEncodings('gzip').indexOf('identity') !== -1); - return test.done(); - }; - - this["Should not return identity encoding if q = 0"] = function(test) { - test.ok(preferredEncodings('identity;q=0').indexOf('identity') === -1); - return test.done(); - }; - - testCorrectEncoding = function(c) { - return _this["Should return " + c.selected + " for accept-encoding header " + c.accept + " with provided encoding " + c.provided] = function(test) { - test.deepEqual(preferredEncodings(c.accept, c.provided), c.selected); - return test.done(); - }; - }; - - testConfigurations = [ - { - accept: 'gzip', - provided: ['identity', 'gzip'], - selected: ['gzip', 'identity'] - }, { - accept: 'gzip, compress', - provided: ['compress'], - selected: ['compress'] - }, { - accept: 'deflate', - provided: ['gzip', 'identity'], - selected: ['identity'] - }, { - accept: '*', - provided: ['identity', 'gzip'], - selected: ['identity', 'gzip'] - }, { - accept: 'gzip, compress', - provided: ['compress', 'identity'], - selected: ['compress', 'identity'] - }, { - accept: 'gzip;q=0.8, identity;q=0.5, *;q=0.3', - provided: ['identity', 'gzip', 'compress'], - selected: ['gzip', 'identity', 'compress'] - }, { - accept: 'gzip;q=0.8, compress', - provided: ['gzip', 'compress'], - selected: ['compress', 'gzip'] - }, { - accept: 'gzip;q=0.8, compress', - provided: null, - selected: ['compress', 'gzip', 'identity'] - } - ]; - - for (_i = 0, _len = testConfigurations.length; _i < _len; _i++) { - configuration = testConfigurations[_i]; - testCorrectEncoding(configuration); - } - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/language.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/language.js deleted file mode 100644 index d98f26de..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/language.js +++ /dev/null @@ -1,70 +0,0 @@ -(function() { - var configuration, preferredLanguages, testConfigurations, testCorrectType, _i, _len, - _this = this; - - preferredLanguages = require('../lib/language').preferredLanguages; - - this["Should not return a language when no is provided"] = function(test) { - test.deepEqual(preferredLanguages('*', []), []); - return test.done(); - }; - - this["Should not return a language when no language is acceptable"] = function(test) { - test.deepEqual(preferredLanguages('en', ['es']), []); - return test.done(); - }; - - this["Should not return a language with q = 0"] = function(test) { - test.deepEqual(preferredLanguages('en;q=0', ['en']), []); - return test.done(); - }; - - testCorrectType = function(c) { - return _this["Should return " + c.selected + " for accept-language header " + c.accept + " with provided language " + c.provided] = function(test) { - test.deepEqual(preferredLanguages(c.accept, c.provided), c.selected); - return test.done(); - }; - }; - - testConfigurations = [ - { - accept: 'en', - provided: ['en'], - selected: ['en'] - }, { - accept: '*', - provided: ['en'], - selected: ['en'] - }, { - accept: 'en-US, en;q=0.8', - provided: ['en-US', 'en-GB'], - selected: ['en-US', 'en-GB'] - }, { - accept: 'en-US, en-GB', - provided: ['en-US'], - selected: ['en-US'] - }, { - accept: 'en', - provided: ['en-US'], - selected: ['en-US'] - }, { - accept: 'en;q=0.8, es', - provided: ['en', 'es'], - selected: ['es', 'en'] - }, { - accept: 'en-US;q=0.8, es', - provided: ['en', 'es'], - selected: ['es', 'en'] - }, { - accept: 'en-US;q=0.8, es', - provided: null, - selected: ['es', 'en-US'] - } - ]; - - for (_i = 0, _len = testConfigurations.length; _i < _len; _i++) { - configuration = testConfigurations[_i]; - testCorrectType(configuration); - } - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/mediaType.js b/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/mediaType.js deleted file mode 100644 index 08e49231..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/negotiator/test/mediaType.js +++ /dev/null @@ -1,70 +0,0 @@ -(function() { - var configuration, preferredMediaTypes, testConfigurations, testCorrectType, _i, _len, - _this = this; - - preferredMediaTypes = require('../lib/mediaType').preferredMediaTypes; - - this["Should not return a media type when no media type provided"] = function(test) { - test.deepEqual(preferredMediaTypes('*/*', []), []); - return test.done(); - }; - - this["Should not return a media type when no media type is acceptable"] = function(test) { - test.deepEqual(preferredMediaTypes('application/json', ['text/html']), []); - return test.done(); - }; - - this["Should not return a media type with q = 0"] = function(test) { - test.deepEqual(preferredMediaTypes('text/html;q=0', ['text/html']), []); - return test.done(); - }; - - testCorrectType = function(c) { - return _this["Should return " + c.selected + " for access header " + c.accept + " with provided types " + c.provided] = function(test) { - test.deepEqual(preferredMediaTypes(c.accept, c.provided), c.selected); - return test.done(); - }; - }; - - testConfigurations = [ - { - accept: 'text/html', - provided: ['text/html'], - selected: ['text/html'] - }, { - accept: '*/*', - provided: ['text/html'], - selected: ['text/html'] - }, { - accept: 'text/*', - provided: ['text/html'], - selected: ['text/html'] - }, { - accept: 'application/json, text/html', - provided: ['text/html'], - selected: ['text/html'] - }, { - accept: 'text/html;q=0.1', - provided: ['text/html'], - selected: ['text/html'] - }, { - accept: 'application/json, text/html', - provided: ['application/json', 'text/html'], - selected: ['application/json', 'text/html'] - }, { - accept: 'application/json;q=0.2, text/html', - provided: ['application/json', 'text/html'], - selected: ['text/html', 'application/json'] - }, { - accept: 'application/json;q=0.2, text/html', - provided: null, - selected: ['text/html', 'application/json'] - } - ]; - - for (_i = 0, _len = testConfigurations.length; _i < _len; _i++) { - configuration = testConfigurations[_i]; - testCorrectType(configuration); - } - -}).call(this); diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/pause/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/pause/.npmignore deleted file mode 100644 index f1250e58..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/pause/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/pause/History.md b/realtime/node_modules/express/node_modules/connect/node_modules/pause/History.md deleted file mode 100644 index c8aa68fa..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/pause/History.md +++ /dev/null @@ -1,5 +0,0 @@ - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/realtime/node_modules/express/node_modules/connect/node_modules/pause/Makefile deleted file mode 100644 index 4e9c8d36..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/pause/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/pause/Readme.md b/realtime/node_modules/express/node_modules/connect/node_modules/pause/Readme.md deleted file mode 100644 index 1cdd68a2..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/pause/Readme.md +++ /dev/null @@ -1,29 +0,0 @@ - -# pause - - Pause streams... - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/pause/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/pause/index.js deleted file mode 100644 index 1b7b3794..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/pause/index.js +++ /dev/null @@ -1,29 +0,0 @@ - -module.exports = function(obj){ - var onData - , onEnd - , events = []; - - // buffer data - obj.on('data', onData = function(data, encoding){ - events.push(['data', data, encoding]); - }); - - // buffer end - obj.on('end', onEnd = function(data, encoding){ - events.push(['end', data, encoding]); - }); - - return { - end: function(){ - obj.removeListener('data', onData); - obj.removeListener('end', onEnd); - }, - resume: function(){ - this.end(); - for (var i = 0, len = events.length; i < len; ++i) { - obj.emit.apply(obj, events[i]); - } - } - }; -}; \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/pause/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/pause/package.json deleted file mode 100644 index edd7930d..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/pause/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "pause", - "version": "0.0.1", - "description": "Pause streams...", - "keywords": [], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "main": "index", - "readme": "\n# pause\n\n Pause streams...\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "_id": "pause@0.0.1", - "dist": { - "shasum": "138b3b78c1cd2c50addc0557010d144b31cca445" - }, - "_from": "pause@0.0.1", - "_resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules b/realtime/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules deleted file mode 100644 index 49e31dac..00000000 --- a/realtime/node_modules/express/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/realtime/node_modules/express/node_modules/connect/node_modules/qs/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/qs/.npmignore deleted file mode 100644 index e85ce2af..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/qs/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -test -.travis.yml -benchmark.js -component.json -examples.js -History.md -Makefile diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/qs/Readme.md b/realtime/node_modules/express/node_modules/connect/node_modules/qs/Readme.md deleted file mode 100644 index 27e54a4a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/qs/Readme.md +++ /dev/null @@ -1,58 +0,0 @@ -# node-querystring - - query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. - -## Installation - - $ npm install qs - -## Examples - -```js -var qs = require('qs'); - -qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); -// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } - -qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) -// => user[name]=Tobi&user[email]=tobi%40learnboost.com -``` - -## Testing - -Install dev dependencies: - - $ npm install -d - -and execute: - - $ make test - -browser: - - $ open test/browser/index.html - -## License - -(The MIT License) - -Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/qs/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/qs/index.js deleted file mode 100644 index b05938ac..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/qs/index.js +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Object#toString() ref for stringify(). - */ - -var toString = Object.prototype.toString; - -/** - * Object#hasOwnProperty ref - */ - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -/** - * Array#indexOf shim. - */ - -var indexOf = typeof Array.prototype.indexOf === 'function' - ? function(arr, el) { return arr.indexOf(el); } - : function(arr, el) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] === el) return i; - } - return -1; - }; - -/** - * Array.isArray shim. - */ - -var isArray = Array.isArray || function(arr) { - return toString.call(arr) == '[object Array]'; -}; - -/** - * Object.keys shim. - */ - -var objectKeys = Object.keys || function(obj) { - var ret = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - ret.push(key); - } - } - return ret; -}; - -/** - * Array#forEach shim. - */ - -var forEach = typeof Array.prototype.forEach === 'function' - ? function(arr, fn) { return arr.forEach(fn); } - : function(arr, fn) { - for (var i = 0; i < arr.length; i++) fn(arr[i]); - }; - -/** - * Array#reduce shim. - */ - -var reduce = function(arr, fn, initial) { - if (typeof arr.reduce === 'function') return arr.reduce(fn, initial); - var res = initial; - for (var i = 0; i < arr.length; i++) res = fn(res, arr[i]); - return res; -}; - -/** - * 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]) { - if (hasOwnProperty.call(parent[key], i)) { - t[i] = parent[key][i]; - } - } - parent[key] = t; - return t; -} - -function parse(parts, parent, key, val) { - var part = parts.shift(); - - // illegal - if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return; - - // end - if (!part) { - if (isArray(parent[key])) { - parent[key].push(val); - } else if ('object' == typeof parent[key]) { - parent[key] = val; - } else if ('undefined' == typeof parent[key]) { - parent[key] = val; - } else { - parent[key] = [parent[key], val]; - } - // array - } else { - var obj = parent[key] = parent[key] || []; - if (']' == part) { - if (isArray(obj)) { - if ('' != val) obj.push(val); - } else if ('object' == typeof obj) { - obj[objectKeys(obj).length] = val; - } else { - obj = parent[key] = [parent[key], val]; - } - // prop - } else if (~indexOf(part, ']')) { - part = part.substr(0, part.length - 1); - if (!isint.test(part) && isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - // key - } else { - if (!isint.test(part) && isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - } - } -} - -/** - * Merge parent key/val pair. - */ - -function merge(parent, key, val){ - if (~indexOf(key, ']')) { - var parts = key.split('[') - , len = parts.length - , last = len - 1; - parse(parts, parent, 'base', val); - // optimize - } else { - if (!isint.test(key) && isArray(parent.base)) { - var t = {}; - for (var k in parent.base) t[k] = parent.base[k]; - parent.base = t; - } - set(parent.base, key, val); - } - - return parent; -} - -/** - * Compact sparse arrays. - */ - -function compact(obj) { - if ('object' != typeof obj) return obj; - - if (isArray(obj)) { - var ret = []; - - for (var i in obj) { - if (hasOwnProperty.call(obj, i)) { - ret.push(obj[i]); - } - } - - return ret; - } - - for (var key in obj) { - obj[key] = compact(obj[key]); - } - - return obj; -} - -/** - * Parse the given obj. - */ - -function parseObject(obj){ - var ret = { base: {} }; - - forEach(objectKeys(obj), function(name){ - merge(ret, name, obj[name]); - }); - - return compact(ret.base); -} - -/** - * Parse the given str. - */ - -function parseString(str){ - var ret = reduce(String(str).split('&'), function(ret, pair){ - var eql = indexOf(pair, '=') - , brace = lastBraceInKey(pair) - , key = pair.substr(0, brace || eql) - , val = pair.substr(brace || eql, pair.length) - , val = val.substr(indexOf(val, '=') + 1, val.length); - - // ?foo - if ('' == key) key = pair, val = ''; - if ('' == key) return ret; - - return merge(ret, decode(key), decode(val)); - }, { base: {} }).base; - - return compact(ret); -} - -/** - * Parse the given query `str` or `obj`, returning an object. - * - * @param {String} str | {Object} obj - * @return {Object} - * @api public - */ - -exports.parse = function(str){ - if (null == str || '' == str) return {}; - return 'object' == typeof str - ? parseObject(str) - : parseString(str); -}; - -/** - * Turn the given `obj` into a query string - * - * @param {Object} obj - * @return {String} - * @api public - */ - -var stringify = exports.stringify = function(obj, prefix) { - if (isArray(obj)) { - return stringifyArray(obj, prefix); - } else if ('[object Object]' == toString.call(obj)) { - return stringifyObject(obj, prefix); - } else if ('string' == typeof obj) { - return stringifyString(obj, prefix); - } else { - return prefix + '=' + encodeURIComponent(String(obj)); - } -}; - -/** - * Stringify the given `str`. - * - * @param {String} str - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyString(str, prefix) { - if (!prefix) throw new TypeError('stringify expects an object'); - return prefix + '=' + encodeURIComponent(str); -} - -/** - * Stringify the given `arr`. - * - * @param {Array} arr - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyArray(arr, prefix) { - var ret = []; - if (!prefix) throw new TypeError('stringify expects an object'); - for (var i = 0; i < arr.length; i++) { - ret.push(stringify(arr[i], prefix + '[' + i + ']')); - } - return ret.join('&'); -} - -/** - * Stringify the given `obj`. - * - * @param {Object} obj - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyObject(obj, prefix) { - var ret = [] - , keys = objectKeys(obj) - , key; - - for (var i = 0, len = keys.length; i < len; ++i) { - key = keys[i]; - if ('' == key) continue; - if (null == obj[key]) { - ret.push(encodeURIComponent(key) + '='); - } else { - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - } - } - - return ret.join('&'); -} - -/** - * Set `obj`'s `key` to `val` respecting - * the weird and wonderful syntax of a qs, - * where "foo=bar&foo=baz" becomes an array. - * - * @param {Object} obj - * @param {String} key - * @param {String} val - * @api private - */ - -function set(obj, key, val) { - var v = obj[key]; - if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return; - if (undefined === v) { - obj[key] = val; - } else if (isArray(v)) { - v.push(val); - } else { - obj[key] = [v, val]; - } -} - -/** - * Locate last brace in `str` within the key. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function lastBraceInKey(str) { - var len = str.length - , brace - , c; - for (var i = 0; i < len; ++i) { - c = str[i]; - if (']' == c) brace = false; - if ('[' == c) brace = true; - if ('=' == c && !brace) return i; - } -} - -/** - * Decode `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -function decode(str) { - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (err) { - return str; - } -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/qs/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/qs/package.json deleted file mode 100644 index ebe7de67..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/qs/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "qs", - "description": "querystring parser", - "version": "0.6.6", - "keywords": [ - "query string", - "parser", - "component" - ], - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/node-querystring.git" - }, - "devDependencies": { - "mocha": "*", - "expect.js": "*" - }, - "scripts": { - "test": "make test" - }, - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "main": "index", - "engines": { - "node": "*" - }, - "readme": "# node-querystring\n\n query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "_id": "qs@0.6.6", - "dist": { - "shasum": "a106b5c23ca4dbbdbcbca55af9e13505bf65a6bc" - }, - "_from": "qs@0.6.6", - "_resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/.npmignore b/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/.npmignore deleted file mode 100644 index b59f7e3a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test/ \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/.travis.yml b/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/.travis.yml deleted file mode 100644 index 595ded21..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -node_js: -- "0.8" -- "0.10" -- "0.11" -language: node_js -matrix: - allow_failures: - - node_js: "0.11" \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/Makefile b/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/Makefile deleted file mode 100644 index 642d6a64..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -NODE ?= node -BIN = ./node_modules/.bin/ - -test: - @${NODE} ${BIN}mocha \ - --reporter spec \ - --bail \ - ./test/index.js - -clean: - @rm -rf node_modules - -.PHONY: test clean diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/README.md b/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/README.md deleted file mode 100644 index 049ef641..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# Raw Body [![Build Status](https://travis-ci.org/stream-utils/raw-body.png)](https://travis-ci.org/stream-utils/raw-body) - -Gets the entire buffer of a stream either as a `Buffer` or a string. -Validates the stream's length against an expected length and maximum limit. -Ideal for parsing request bodies. - -## API - -```js -var getRawBody = require('raw-body') - -app.use(function (req, res, next) { - getRawBody(req, { - length: req.headers['content-length'], - limit: '1mb', - encoding: 'utf8' - }, function (err, string) { - if (err) - return next(err) - - req.text = string - next() - }) -}) -``` - -or in a Koa generator: - -```js -app.use(function* (next) { - var string = yield getRawBody(this.req, { - length: this.length, - limit: '1mb', - encoding: 'utf8' - }) -}) -``` - -### getRawBody(stream, [options], [callback]) - -Returns a thunk for yielding with generators. - -Options: - -- `length` - The length length of the stream. - If the contents of the stream do not add up to this length, - an `400` error code is returned. -- `limit` - The byte limit of the body. - If the body ends up being larger than this limit, - a `413` error code is returned. -- `encoding` - The requested encoding. - By default, a `Buffer` instance will be returned. - Most likely, you want `utf8`. - You can use any type of encoding supported by [StringDecoder](http://nodejs.org/api/string_decoder.html). - You can also pass `true` which sets it to the default `utf8` - -`callback(err, res)`: - -- `err` - the following attributes will be defined if applicable: - - - `limit` - the limit in bytes - - `length` and `expected` - the expected length of the stream - - `received` - the received bytes - - `status` and `statusCode` - the corresponding status code for the error - - `type` - either `entity.too.large`, `request.size.invalid`, or `stream.encoding.set` - -- `res` - the result, either as a `String` if an encoding was set or a `Buffer` otherwise. - -If an error occurs, the stream will be paused, -and you are responsible for correctly disposing the stream. -For HTTP requests, no handling is required if you send a response. -For streams that use file descriptors, you should `stream.destroy()` or `stream.close()` to prevent leaks. - -## License - -The MIT License (MIT) - -Copyright (c) 2013 Jonathan Ong me@jongleberry.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/index.js deleted file mode 100644 index b1798654..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/index.js +++ /dev/null @@ -1,160 +0,0 @@ -var StringDecoder = require('string_decoder').StringDecoder -var bytes = require('bytes') - -module.exports = function (stream, options, done) { - if (typeof options === 'function') { - done = options - options = {} - } else if (!options) { - options = {} - } - - // convert the limit to an integer - var limit = null - if (typeof options.limit === 'number') - limit = options.limit - if (typeof options.limit === 'string') - limit = bytes(options.limit) - - // convert the expected length to an integer - var length = null - if (!isNaN(options.length)) - length = parseInt(options.length, 10) - - // check the length and limit options. - // note: we intentionally leave the stream paused, - // so users should handle the stream themselves. - if (limit !== null && length !== null && length > limit) { - if (typeof stream.pause === 'function') - stream.pause() - - process.nextTick(function () { - var err = makeError('request entity too large', 'entity.too.large') - err.status = err.statusCode = 413 - err.length = err.expected = length - err.limit = limit - done(err) - }) - return defer - } - - var state = stream._readableState - // streams2+: assert the stream encoding is buffer. - if (state && state.encoding != null) { - if (typeof stream.pause === 'function') - stream.pause() - - process.nextTick(function () { - var err = makeError('stream encoding should not be set', - 'stream.encoding.set') - // developer error - err.status = err.statusCode = 500 - done(err) - }) - return defer - } - - var received = 0 - // note: we delegate any invalid encodings to the constructor - var decoder = options.encoding - ? new StringDecoder(options.encoding === true ? 'utf8' : options.encoding) - : null - var buffer = decoder - ? '' - : [] - - stream.on('data', onData) - stream.once('end', onEnd) - stream.once('error', onEnd) - stream.once('close', cleanup) - - return defer - - // yieldable support - function defer(fn) { - done = fn - } - - function onData(chunk) { - received += chunk.length - decoder - ? buffer += decoder.write(chunk) - : buffer.push(chunk) - - if (limit !== null && received > limit) { - if (typeof stream.pause === 'function') - stream.pause() - var err = makeError('request entity too large', 'entity.too.large') - err.status = err.statusCode = 413 - err.received = received - err.limit = limit - done(err) - cleanup() - } - } - - function onEnd(err) { - if (err) { - if (typeof stream.pause === 'function') - stream.pause() - done(err) - } else if (length !== null && received !== length) { - err = makeError('request size did not match content length', - 'request.size.invalid') - err.status = err.statusCode = 400 - err.received = received - err.length = err.expected = length - done(err) - } else { - done(null, decoder - ? buffer + endStringDecoder(decoder) - : Buffer.concat(buffer) - ) - } - - cleanup() - } - - function cleanup() { - received = buffer = null - - stream.removeListener('data', onData) - stream.removeListener('end', onEnd) - stream.removeListener('error', onEnd) - stream.removeListener('close', cleanup) - } -} - -// to create serializable errors you must re-set message so -// that it is enumerable and you must re configure the type -// property so that is writable and enumerable -function makeError(message, type) { - var error = new Error() - error.message = message - Object.defineProperty(error, 'type', { - value: type, - enumerable: true, - writable: true, - configurable: true - }) - return error -} - -// https://github.com/Raynos/body/blob/2512ced39e31776e5a2f7492b907330badac3a40/index.js#L72 -// bug fix for missing `StringDecoder.end` in v0.8.x -function endStringDecoder(decoder) { - if (decoder.end) { - return decoder.end() - } - - var res = "" - - if (decoder.charReceived) { - var cr = decoder.charReceived - var buf = decoder.charBuffer - var enc = decoder.encoding - res += buf.slice(0, cr).toString(enc) - } - - return res -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/package.json deleted file mode 100644 index 5ca4b21a..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/raw-body/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "raw-body", - "description": "Get and validate the raw body of a readable stream.", - "version": "1.1.2", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/stream-utils/raw-body.git" - }, - "bugs": { - "mail": "me@jongleberry.com", - "url": "https://github.com/stream-utils/raw-body/issues" - }, - "dependencies": { - "bytes": "~0.2.1" - }, - "devDependencies": { - "readable-stream": "~1.0.17", - "co": "2", - "gnode": "~0.0.4", - "mocha": "~1.14.0", - "through": "~2.3.4", - "request": "~2.27.0", - "assert-tap": "~0.1.4" - }, - "scripts": { - "test": "NODE=gnode make test && node ./test/acceptance.js" - }, - "engines": { - "node": ">= 0.8.0" - }, - "readme": "# Raw Body [![Build Status](https://travis-ci.org/stream-utils/raw-body.png)](https://travis-ci.org/stream-utils/raw-body)\n\nGets the entire buffer of a stream either as a `Buffer` or a string.\nValidates the stream's length against an expected length and maximum limit.\nIdeal for parsing request bodies.\n\n## API\n\n```js\nvar getRawBody = require('raw-body')\n\napp.use(function (req, res, next) {\n getRawBody(req, {\n length: req.headers['content-length'],\n limit: '1mb',\n encoding: 'utf8'\n }, function (err, string) {\n if (err)\n return next(err)\n\n req.text = string\n next()\n })\n})\n```\n\nor in a Koa generator:\n\n```js\napp.use(function* (next) {\n var string = yield getRawBody(this.req, {\n length: this.length,\n limit: '1mb',\n encoding: 'utf8'\n })\n})\n```\n\n### getRawBody(stream, [options], [callback])\n\nReturns a thunk for yielding with generators.\n\nOptions:\n\n- `length` - The length length of the stream.\n If the contents of the stream do not add up to this length,\n an `400` error code is returned.\n- `limit` - The byte limit of the body.\n If the body ends up being larger than this limit,\n a `413` error code is returned.\n- `encoding` - The requested encoding.\n By default, a `Buffer` instance will be returned.\n Most likely, you want `utf8`.\n You can use any type of encoding supported by [StringDecoder](http://nodejs.org/api/string_decoder.html).\n You can also pass `true` which sets it to the default `utf8`\n\n`callback(err, res)`:\n\n- `err` - the following attributes will be defined if applicable:\n\n - `limit` - the limit in bytes\n - `length` and `expected` - the expected length of the stream\n - `received` - the received bytes\n - `status` and `statusCode` - the corresponding status code for the error\n - `type` - either `entity.too.large`, `request.size.invalid`, or `stream.encoding.set`\n\n- `res` - the result, either as a `String` if an encoding was set or a `Buffer` otherwise.\n\nIf an error occurs, the stream will be paused,\nand you are responsible for correctly disposing the stream.\nFor HTTP requests, no handling is required if you send a response.\nFor streams that use file descriptors, you should `stream.destroy()` or `stream.close()` to prevent leaks.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2013 Jonathan Ong me@jongleberry.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", - "readmeFilename": "README.md", - "_id": "raw-body@1.1.2", - "dist": { - "shasum": "edcf77fcb1c94434f8b6125b1104abf4c6b2edd4" - }, - "_from": "raw-body@1.1.2", - "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.2.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/uid2/LICENSE b/realtime/node_modules/express/node_modules/connect/node_modules/uid2/LICENSE deleted file mode 100644 index bdfab69b..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/uid2/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Marco Aurelio - -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/realtime/node_modules/express/node_modules/connect/node_modules/uid2/index.js b/realtime/node_modules/express/node_modules/connect/node_modules/uid2/index.js deleted file mode 100644 index 6240b308..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/uid2/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Module dependencies - */ - -var crypto = require('crypto'); - -/** - * 62 characters in the ascii range that can be used in URLs without special - * encoding. - */ -var UIDCHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - -/** - * Make a Buffer into a string ready for use in URLs - * - * @param {String} - * @returns {String} - * @api private - */ -function tostr(bytes) { - var chars, r, i; - - r = []; - for (i = 0; i < bytes.length; i++) { - r.push(UIDCHARS[bytes[i] % UIDCHARS.length]); - } - - return r.join(''); -} - -/** - * Generate an Unique Id - * - * @param {Number} length The number of chars of the uid - * @param {Number} cb (optional) Callback for async uid generation - * @api public - */ - -function uid(length, cb) { - - if (typeof cb === 'undefined') { - return tostr(crypto.pseudoRandomBytes(length)); - } else { - crypto.pseudoRandomBytes(length, function(err, bytes) { - if (err) return cb(err); - cb(null, tostr(bytes)); - }) - } -} - -/** - * Exports - */ - -module.exports = uid; diff --git a/realtime/node_modules/express/node_modules/connect/node_modules/uid2/package.json b/realtime/node_modules/express/node_modules/connect/node_modules/uid2/package.json deleted file mode 100644 index a98485bd..00000000 --- a/realtime/node_modules/express/node_modules/connect/node_modules/uid2/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "uid2", - "description": "strong uid", - "tags": [ - "uid" - ], - "version": "0.0.3", - "dependencies": {}, - "_id": "uid2@0.0.3", - "readme": "ERROR: No README.md file found!", - "dist": { - "shasum": "8c74151f449949b1bd589cb342e5c8ca77c5b5dc" - }, - "_from": "uid2@0.0.3", - "_resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz" -} diff --git a/realtime/node_modules/express/node_modules/connect/package.json b/realtime/node_modules/express/node_modules/connect/package.json deleted file mode 100644 index 35ef5a07..00000000 --- a/realtime/node_modules/express/node_modules/connect/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "connect", - "version": "2.12.0", - "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": { - "batch": "0.5.0", - "qs": "0.6.6", - "cookie-signature": "1.0.1", - "buffer-crc32": "0.2.1", - "cookie": "0.1.0", - "send": "0.1.4", - "bytes": "0.2.1", - "fresh": "0.2.0", - "pause": "0.0.1", - "uid2": "0.0.3", - "debug": ">= 0.7.3 < 1", - "methods": "0.1.0", - "raw-body": "1.1.2", - "negotiator": "0.3.0", - "multiparty": "2.2.0" - }, - "devDependencies": { - "should": ">= 2.0.2 < 3", - "mocha": ">= 1.13.0 < 2", - "jade": ">= 0.35.0 < 1", - "dox": ">= 0.4.4 < 1" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://raw.github.com/senchalabs/connect/master/LICENSE" - } - ], - "main": "index", - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "make" - }, - "readme": "# Connect [![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect)\n\n Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance \"plugins\" known as _middleware_.\n\n Connect is bundled with over _20_ commonly used middleware, including\n a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/).\n\n```js\nvar connect = require('connect')\n , http = require('http');\n\nvar app = connect()\n .use(connect.favicon())\n .use(connect.logger('dev'))\n .use(connect.static('public'))\n .use(connect.directory('public'))\n .use(connect.cookieParser())\n .use(connect.session({ secret: 'my secret here' }))\n .use(function(req, res){\n res.end('Hello from Connect!\\n');\n });\n\nhttp.createServer(app).listen(3000);\n```\n\n## Middleware\n\n - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)\n - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)\n - [compress](http://www.senchalabs.org/connect/compress.html)\n - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)\n - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)\n - [csrf](http://www.senchalabs.org/connect/csrf.html)\n - [directory](http://www.senchalabs.org/connect/directory.html)\n - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)\n - [favicon](http://www.senchalabs.org/connect/favicon.html)\n - [json](http://www.senchalabs.org/connect/json.html)\n - [limit](http://www.senchalabs.org/connect/limit.html)\n - [logger](http://www.senchalabs.org/connect/logger.html)\n - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html)\n - [multipart](http://www.senchalabs.org/connect/multipart.html)\n - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)\n - [query](http://www.senchalabs.org/connect/query.html)\n - [responseTime](http://www.senchalabs.org/connect/responseTime.html)\n - [session](http://www.senchalabs.org/connect/session.html)\n - [static](http://www.senchalabs.org/connect/static.html)\n - [staticCache](http://www.senchalabs.org/connect/staticCache.html)\n - [subdomains](http://www.senchalabs.org/connect/subdomains.html)\n - [vhost](http://www.senchalabs.org/connect/vhost.html)\n\n## Running Tests\n\nfirst:\n\n $ npm install -d\n\nthen:\n\n $ make test\n\n## Contributors\n\n https://github.com/senchalabs/connect/graphs/contributors\n\n## Node Compatibility\n\n Connect `< 1.x` is compatible with node 0.2.x\n\n\n Connect `1.x` is compatible with node 0.4.x\n\n\n Connect `2.x` is compatible with node 0.6.x\n\n\n Connect (_master_) is compatible with node 0.8.x\n\n## CLA\n\n [http://sencha.com/cla](http://sencha.com/cla)\n\n## License\n\nView the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).\n", - "readmeFilename": "Readme.md", - "_id": "connect@2.12.0", - "dist": { - "shasum": "7b5b6303bf6855c9cc6e8cc9d4662b2040e2a7ec" - }, - "_from": "connect@2.12.0", - "_resolved": "https://registry.npmjs.org/connect/-/connect-2.12.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/cookie-signature/.npmignore b/realtime/node_modules/express/node_modules/cookie-signature/.npmignore deleted file mode 100644 index f1250e58..00000000 --- a/realtime/node_modules/express/node_modules/cookie-signature/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/realtime/node_modules/express/node_modules/cookie-signature/History.md b/realtime/node_modules/express/node_modules/cookie-signature/History.md deleted file mode 100644 index 9e301799..00000000 --- a/realtime/node_modules/express/node_modules/cookie-signature/History.md +++ /dev/null @@ -1,11 +0,0 @@ - -1.0.1 / 2013-04-15 -================== - - * Revert "Changed underlying HMAC algo. to sha512." - * Revert "Fix for timing attacks on MAC verification." - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/express/node_modules/cookie-signature/Makefile b/realtime/node_modules/express/node_modules/cookie-signature/Makefile deleted file mode 100644 index 4e9c8d36..00000000 --- a/realtime/node_modules/express/node_modules/cookie-signature/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/cookie-signature/Readme.md b/realtime/node_modules/express/node_modules/cookie-signature/Readme.md deleted file mode 100644 index 2559e841..00000000 --- a/realtime/node_modules/express/node_modules/cookie-signature/Readme.md +++ /dev/null @@ -1,42 +0,0 @@ - -# cookie-signature - - Sign and unsign cookies. - -## Example - -```js -var cookie = require('cookie-signature'); - -var val = cookie.sign('hello', 'tobiiscool'); -val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); - -var val = cookie.sign('hello', 'tobiiscool'); -cookie.unsign(val, 'tobiiscool').should.equal('hello'); -cookie.unsign(val, 'luna').should.be.false; -``` - -## License - -(The MIT License) - -Copyright (c) 2012 LearnBoost <tj@learnboost.com> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/cookie-signature/index.js b/realtime/node_modules/express/node_modules/cookie-signature/index.js deleted file mode 100644 index ed62814e..00000000 --- a/realtime/node_modules/express/node_modules/cookie-signature/index.js +++ /dev/null @@ -1,42 +0,0 @@ - -/** - * Module dependencies. - */ - -var crypto = require('crypto'); - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String} secret - * @return {String} - * @api private - */ - -exports.sign = function(val, secret){ - if ('string' != typeof val) throw new TypeError('cookie required'); - if ('string' != typeof secret) throw new TypeError('secret required'); - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/\=+$/, ''); -}; - -/** - * Unsign and decode the given `val` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} val - * @param {String} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(val, secret){ - if ('string' != typeof val) throw new TypeError('cookie required'); - if ('string' != typeof secret) throw new TypeError('secret required'); - var str = val.slice(0, val.lastIndexOf('.')); - return exports.sign(str, secret) == val ? str : false; -}; diff --git a/realtime/node_modules/express/node_modules/cookie-signature/package.json b/realtime/node_modules/express/node_modules/cookie-signature/package.json deleted file mode 100644 index 83e626ed..00000000 --- a/realtime/node_modules/express/node_modules/cookie-signature/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "cookie-signature", - "version": "1.0.1", - "description": "Sign and unsign cookies", - "keywords": [ - "cookie", - "sign", - "unsign" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@learnboost.com" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "main": "index", - "readme": "\n# cookie-signature\n\n Sign and unsign cookies.\n\n## Example\n\n```js\nvar cookie = require('cookie-signature');\n\nvar val = cookie.sign('hello', 'tobiiscool');\nval.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');\n\nvar val = cookie.sign('hello', 'tobiiscool');\ncookie.unsign(val, 'tobiiscool').should.equal('hello');\ncookie.unsign(val, 'luna').should.be.false;\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 LearnBoost <tj@learnboost.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "_id": "cookie-signature@1.0.1", - "dist": { - "shasum": "7e3df42cfbcdf15f0f8e05ee3152cb6c95cdc681" - }, - "_from": "cookie-signature@1.0.1", - "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz" -} diff --git a/realtime/node_modules/express/node_modules/cookie/.npmignore b/realtime/node_modules/express/node_modules/cookie/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/realtime/node_modules/express/node_modules/cookie/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/realtime/node_modules/express/node_modules/cookie/.travis.yml b/realtime/node_modules/express/node_modules/cookie/.travis.yml deleted file mode 100644 index 9400c118..00000000 --- a/realtime/node_modules/express/node_modules/cookie/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.6" - - "0.8" - - "0.10" diff --git a/realtime/node_modules/express/node_modules/cookie/LICENSE b/realtime/node_modules/express/node_modules/cookie/LICENSE deleted file mode 100644 index 249d9def..00000000 --- a/realtime/node_modules/express/node_modules/cookie/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -// MIT License - -Copyright (C) Roman Shtylman - -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/realtime/node_modules/express/node_modules/cookie/README.md b/realtime/node_modules/express/node_modules/cookie/README.md deleted file mode 100644 index 5187ed1c..00000000 --- a/realtime/node_modules/express/node_modules/cookie/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) # - -cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers. - -See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies. - -## how? - -``` -npm install cookie -``` - -```javascript -var cookie = require('cookie'); - -var hdr = cookie.serialize('foo', 'bar'); -// hdr = 'foo=bar'; - -var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff'); -// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' }; -``` - -## more - -The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values. - -### path -> cookie path - -### expires -> absolute expiration date for the cookie (Date object) - -### maxAge -> relative max age of the cookie from when the client receives it (seconds) - -### domain -> domain for the cookie - -### secure -> true or false - -### httpOnly -> true or false - diff --git a/realtime/node_modules/express/node_modules/cookie/index.js b/realtime/node_modules/express/node_modules/cookie/index.js deleted file mode 100644 index 16bdb65d..00000000 --- a/realtime/node_modules/express/node_modules/cookie/index.js +++ /dev/null @@ -1,70 +0,0 @@ - -/// Serialize the a name value pair into a cookie string suitable for -/// http headers. An optional options object specified cookie parameters -/// -/// serialize('foo', 'bar', { httpOnly: true }) -/// => "foo=bar; httpOnly" -/// -/// @param {String} name -/// @param {String} val -/// @param {Object} options -/// @return {String} -var serialize = function(name, val, opt){ - opt = opt || {}; - var enc = opt.encode || encode; - var pairs = [name + '=' + enc(val)]; - - if (opt.maxAge) pairs.push('Max-Age=' + opt.maxAge); - if (opt.domain) pairs.push('Domain=' + opt.domain); - if (opt.path) pairs.push('Path=' + opt.path); - if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString()); - if (opt.httpOnly) pairs.push('HttpOnly'); - if (opt.secure) pairs.push('Secure'); - - return pairs.join('; '); -}; - -/// Parse the given cookie header string into an object -/// The object has the various cookies as keys(names) => values -/// @param {String} str -/// @return {Object} -var parse = function(str, opt) { - opt = opt || {}; - var obj = {} - var pairs = str.split(/[;,] */); - var dec = opt.decode || decode; - - pairs.forEach(function(pair) { - var eq_idx = pair.indexOf('=') - - // skip things that don't look like key=value - if (eq_idx < 0) { - return; - } - - var key = pair.substr(0, eq_idx).trim() - var val = pair.substr(++eq_idx, pair.length).trim(); - - // quoted values - if ('"' == val[0]) { - val = val.slice(1, -1); - } - - // only assign once - if (undefined == obj[key]) { - try { - obj[key] = dec(val); - } catch (e) { - obj[key] = val; - } - } - }); - - return obj; -}; - -var encode = encodeURIComponent; -var decode = decodeURIComponent; - -module.exports.serialize = serialize; -module.exports.parse = parse; diff --git a/realtime/node_modules/express/node_modules/cookie/package.json b/realtime/node_modules/express/node_modules/cookie/package.json deleted file mode 100644 index 5e5896c7..00000000 --- a/realtime/node_modules/express/node_modules/cookie/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "author": { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - "name": "cookie", - "description": "cookie parsing and serialization", - "version": "0.1.0", - "repository": { - "type": "git", - "url": "git://github.com/shtylman/node-cookie.git" - }, - "keywords": [ - "cookie", - "cookies" - ], - "main": "index.js", - "scripts": { - "test": "mocha" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "1.x.x" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) #\n\ncookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.\n\nSee [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.\n\n## how?\n\n```\nnpm install cookie\n```\n\n```javascript\nvar cookie = require('cookie');\n\nvar hdr = cookie.serialize('foo', 'bar');\n// hdr = 'foo=bar';\n\nvar cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');\n// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };\n```\n\n## more\n\nThe serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.\n\n### path\n> cookie path\n\n### expires\n> absolute expiration date for the cookie (Date object)\n\n### maxAge\n> relative max age of the cookie from when the client receives it (seconds)\n\n### domain\n> domain for the cookie\n\n### secure\n> true or false\n\n### httpOnly\n> true or false\n\n", - "readmeFilename": "README.md", - "_id": "cookie@0.1.0", - "dist": { - "shasum": "e6a72329570ab5a3b38a8a29c5094643959ff286" - }, - "_from": "cookie@0.1.0", - "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/cookie/test/mocha.opts b/realtime/node_modules/express/node_modules/cookie/test/mocha.opts deleted file mode 100644 index e2bfcc5a..00000000 --- a/realtime/node_modules/express/node_modules/cookie/test/mocha.opts +++ /dev/null @@ -1 +0,0 @@ ---ui qunit diff --git a/realtime/node_modules/express/node_modules/cookie/test/parse.js b/realtime/node_modules/express/node_modules/cookie/test/parse.js deleted file mode 100644 index c6c27a20..00000000 --- a/realtime/node_modules/express/node_modules/cookie/test/parse.js +++ /dev/null @@ -1,44 +0,0 @@ - -var assert = require('assert'); - -var cookie = require('..'); - -suite('parse'); - -test('basic', function() { - assert.deepEqual({ foo: 'bar' }, cookie.parse('foo=bar')); - assert.deepEqual({ foo: '123' }, cookie.parse('foo=123')); -}); - -test('ignore spaces', function() { - assert.deepEqual({ FOO: 'bar', baz: 'raz' }, - cookie.parse('FOO = bar; baz = raz')); -}); - -test('escaping', function() { - assert.deepEqual({ foo: 'bar=123456789&name=Magic+Mouse' }, - cookie.parse('foo="bar=123456789&name=Magic+Mouse"')); - - assert.deepEqual({ email: ' ",;/' }, - cookie.parse('email=%20%22%2c%3b%2f')); -}); - -test('ignore escaping error and return original value', function() { - assert.deepEqual({ foo: '%1', bar: 'bar' }, cookie.parse('foo=%1;bar=bar')); -}); - -test('ignore non values', function() { - assert.deepEqual({ foo: '%1', bar: 'bar' }, cookie.parse('foo=%1;bar=bar;HttpOnly;Secure')); -}); - -test('unencoded', function() { - assert.deepEqual({ foo: 'bar=123456789&name=Magic+Mouse' }, - cookie.parse('foo="bar=123456789&name=Magic+Mouse"',{ - decode: function(value) { return value; } - })); - - assert.deepEqual({ email: '%20%22%2c%3b%2f' }, - cookie.parse('email=%20%22%2c%3b%2f',{ - decode: function(value) { return value; } - })); -}) diff --git a/realtime/node_modules/express/node_modules/cookie/test/serialize.js b/realtime/node_modules/express/node_modules/cookie/test/serialize.js deleted file mode 100644 index 86bb8c93..00000000 --- a/realtime/node_modules/express/node_modules/cookie/test/serialize.js +++ /dev/null @@ -1,64 +0,0 @@ -// builtin -var assert = require('assert'); - -var cookie = require('..'); - -suite('serialize'); - -test('basic', function() { - assert.equal('foo=bar', cookie.serialize('foo', 'bar')); - assert.equal('foo=bar%20baz', cookie.serialize('foo', 'bar baz')); -}); - -test('path', function() { - assert.equal('foo=bar; Path=/', cookie.serialize('foo', 'bar', { - path: '/' - })); -}); - -test('secure', function() { - assert.equal('foo=bar; Secure', cookie.serialize('foo', 'bar', { - secure: true - })); - - assert.equal('foo=bar', cookie.serialize('foo', 'bar', { - secure: false - })); -}); - -test('domain', function() { - assert.equal('foo=bar; Domain=example.com', cookie.serialize('foo', 'bar', { - domain: 'example.com' - })); -}); - -test('httpOnly', function() { - assert.equal('foo=bar; HttpOnly', cookie.serialize('foo', 'bar', { - httpOnly: true - })); -}); - -test('maxAge', function() { - assert.equal('foo=bar; Max-Age=1000', cookie.serialize('foo', 'bar', { - maxAge: 1000 - })); -}); - -test('escaping', function() { - assert.deepEqual('cat=%2B%20', cookie.serialize('cat', '+ ')); -}); - -test('parse->serialize', function() { - - assert.deepEqual({ cat: 'foo=123&name=baz five' }, cookie.parse( - cookie.serialize('cat', 'foo=123&name=baz five'))); - - assert.deepEqual({ cat: ' ";/' }, cookie.parse( - cookie.serialize('cat', ' ";/'))); -}); - -test('unencoded', function() { - assert.deepEqual('cat=+ ', cookie.serialize('cat', '+ ', { - encode: function(value) { return value; } - })); -}) diff --git a/realtime/node_modules/express/node_modules/debug/Readme.md b/realtime/node_modules/express/node_modules/debug/Readme.md deleted file mode 100644 index c5a34e8b..00000000 --- a/realtime/node_modules/express/node_modules/debug/Readme.md +++ /dev/null @@ -1,115 +0,0 @@ -# debug - - tiny node.js debugging utility modelled after node core's debugging technique. - -## Installation - -``` -$ npm install debug -``` - -## Usage - - With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stderr is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - _(NOTE: Debug now uses stderr instead of stdout, so the correct shell command for this example is actually `DEBUG=* node example/worker 2> out &`)_ - - ![](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 <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/debug/debug.js b/realtime/node_modules/express/node_modules/debug/debug.js deleted file mode 100644 index 509dc0de..00000000 --- a/realtime/node_modules/express/node_modules/debug/debug.js +++ /dev/null @@ -1,137 +0,0 @@ - -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - if (!debug.enabled(name)) return function(){}; - - return function(fmt){ - fmt = coerce(fmt); - - var curr = new Date; - var ms = curr - (debug[name] || curr); - debug[name] = curr; - - fmt = name - + ' ' - + fmt - + ' +' + debug.humanize(ms); - - // This hackery is required for IE8 - // where `console.log` doesn't have 'apply' - window.console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); - } -} - -/** - * The currently active debug mode names. - */ - -debug.names = []; -debug.skips = []; - -/** - * Enables a debug mode by name. This can include modes - * separated by a colon and wildcards. - * - * @param {String} name - * @api public - */ - -debug.enable = function(name) { - try { - localStorage.debug = name; - } catch(e){} - - var split = (name || '').split(/[\s,]+/) - , len = split.length; - - for (var i = 0; i < len; i++) { - name = split[i].replace('*', '.*?'); - if (name[0] === '-') { - debug.skips.push(new RegExp('^' + name.substr(1) + '$')); - } - else { - debug.names.push(new RegExp('^' + name + '$')); - } - } -}; - -/** - * Disable debug output. - * - * @api public - */ - -debug.disable = function(){ - debug.enable(''); -}; - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -debug.humanize = function(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -}; - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -debug.enabled = function(name) { - for (var i = 0, len = debug.skips.length; i < len; i++) { - if (debug.skips[i].test(name)) { - return false; - } - } - for (var i = 0, len = debug.names.length; i < len; i++) { - if (debug.names[i].test(name)) { - return true; - } - } - return false; -}; - -/** - * Coerce `val`. - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} - -// persist - -try { - if (window.localStorage) debug.enable(localStorage.debug); -} catch(e){} diff --git a/realtime/node_modules/express/node_modules/debug/index.js b/realtime/node_modules/express/node_modules/debug/index.js deleted file mode 100644 index e02c13b7..00000000 --- a/realtime/node_modules/express/node_modules/debug/index.js +++ /dev/null @@ -1,5 +0,0 @@ -if ('undefined' == typeof window) { - module.exports = require('./lib/debug'); -} else { - module.exports = require('./debug'); -} diff --git a/realtime/node_modules/express/node_modules/debug/lib/debug.js b/realtime/node_modules/express/node_modules/debug/lib/debug.js deleted file mode 100644 index 3b0a9183..00000000 --- a/realtime/node_modules/express/node_modules/debug/lib/debug.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Module dependencies. - */ - -var tty = require('tty'); - -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Enabled debuggers. - */ - -var names = [] - , skips = []; - -(process.env.DEBUG || '') - .split(/[\s,]+/) - .forEach(function(name){ - name = name.replace('*', '.*?'); - if (name[0] === '-') { - skips.push(new RegExp('^' + name.substr(1) + '$')); - } else { - names.push(new RegExp('^' + name + '$')); - } - }); - -/** - * Colors. - */ - -var colors = [6, 2, 3, 4, 5, 1]; - -/** - * Previous debug() call. - */ - -var prev = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Is stdout a TTY? Colored output is disabled when `true`. - */ - -var isatty = tty.isatty(2); - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function color() { - return colors[prevColor++ % colors.length]; -} - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -function humanize(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -} - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - function disabled(){} - disabled.enabled = false; - - var match = skips.some(function(re){ - return re.test(name); - }); - - if (match) return disabled; - - match = names.some(function(re){ - return re.test(name); - }); - - if (!match) return disabled; - var c = color(); - - function colored(fmt) { - fmt = coerce(fmt); - - var curr = new Date; - var ms = curr - (prev[name] || curr); - prev[name] = curr; - - fmt = ' \u001b[9' + c + 'm' + name + ' ' - + '\u001b[3' + c + 'm\u001b[90m' - + fmt + '\u001b[3' + c + 'm' - + ' +' + humanize(ms) + '\u001b[0m'; - - console.error.apply(this, arguments); - } - - function plain(fmt) { - fmt = coerce(fmt); - - fmt = new Date().toUTCString() - + ' ' + name + ' ' + fmt; - console.error.apply(this, arguments); - } - - colored.enabled = plain.enabled = true; - - return isatty || process.env.DEBUG_COLORS - ? colored - : plain; -} - -/** - * Coerce `val`. - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/realtime/node_modules/express/node_modules/debug/package.json b/realtime/node_modules/express/node_modules/debug/package.json deleted file mode 100644 index dc5d7223..00000000 --- a/realtime/node_modules/express/node_modules/debug/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "debug", - "version": "0.7.4", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*" - }, - "main": "lib/debug.js", - "browser": "./debug.js", - "engines": { - "node": "*" - }, - "files": [ - "lib/debug.js", - "debug.js", - "index.js" - ], - "component": { - "scripts": { - "debug/index.js": "index.js", - "debug/debug.js": "debug.js" - } - }, - "readme": "# debug\n\n tiny node.js debugging utility modelled after node core's debugging technique.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Usage\n\n With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stderr is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n _(NOTE: Debug now uses stderr instead of stdout, so the correct shell command for this example is actually `DEBUG=* node example/worker 2> out &`)_\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n \n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "debug@0.7.4", - "dist": { - "shasum": "d00d9af32ec718b7d3120b8a08f01fac85a49a3e" - }, - "_from": "debug@>= 0.7.3 < 1", - "_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz" -} diff --git a/realtime/node_modules/express/node_modules/fresh/.npmignore b/realtime/node_modules/express/node_modules/fresh/.npmignore deleted file mode 100644 index 9daeafb9..00000000 --- a/realtime/node_modules/express/node_modules/fresh/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/realtime/node_modules/express/node_modules/fresh/History.md b/realtime/node_modules/express/node_modules/fresh/History.md deleted file mode 100644 index 60a2903f..00000000 --- a/realtime/node_modules/express/node_modules/fresh/History.md +++ /dev/null @@ -1,5 +0,0 @@ - -0.2.0 / 2013-08-11 -================== - - * fix: return false for no-cache diff --git a/realtime/node_modules/express/node_modules/fresh/Makefile b/realtime/node_modules/express/node_modules/fresh/Makefile deleted file mode 100644 index 8e8640f2..00000000 --- a/realtime/node_modules/express/node_modules/fresh/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --reporter spec \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/fresh/Readme.md b/realtime/node_modules/express/node_modules/fresh/Readme.md deleted file mode 100644 index 61366c57..00000000 --- a/realtime/node_modules/express/node_modules/fresh/Readme.md +++ /dev/null @@ -1,57 +0,0 @@ - -# node-fresh - - HTTP response freshness testing - -## fresh(req, res) - - Check freshness of `req` and `res` headers. - - When the cache is "fresh" __true__ is returned, - otherwise __false__ is returned to indicate that - the cache is now stale. - -## Example: - -```js -var req = { 'if-none-match': 'tobi' }; -var res = { 'etag': 'luna' }; -fresh(req, res); -// => false - -var req = { 'if-none-match': 'tobi' }; -var res = { 'etag': 'tobi' }; -fresh(req, res); -// => true -``` - -## Installation - -``` -$ npm install fresh -``` - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/fresh/index.js b/realtime/node_modules/express/node_modules/fresh/index.js deleted file mode 100644 index 9c3f47d1..00000000 --- a/realtime/node_modules/express/node_modules/fresh/index.js +++ /dev/null @@ -1,53 +0,0 @@ - -/** - * Expose `fresh()`. - */ - -module.exports = fresh; - -/** - * Check freshness of `req` and `res` headers. - * - * When the cache is "fresh" __true__ is returned, - * otherwise __false__ is returned to indicate that - * the cache is now stale. - * - * @param {Object} req - * @param {Object} res - * @return {Boolean} - * @api public - */ - -function fresh(req, res) { - // defaults - var etagMatches = true; - var notModified = true; - - // fields - var modifiedSince = req['if-modified-since']; - var noneMatch = req['if-none-match']; - var lastModified = res['last-modified']; - var etag = res['etag']; - var cc = req['cache-control']; - - // unconditional request - if (!modifiedSince && !noneMatch) return false; - - // check for no-cache cache request directive - if (cc && cc.indexOf('no-cache') !== -1) return false; - - // parse if-none-match - if (noneMatch) noneMatch = noneMatch.split(/ *, */); - - // if-none-match - if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0]; - - // if-modified-since - if (modifiedSince) { - modifiedSince = new Date(modifiedSince); - lastModified = new Date(lastModified); - notModified = lastModified <= modifiedSince; - } - - return !! (etagMatches && notModified); -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/fresh/package.json b/realtime/node_modules/express/node_modules/fresh/package.json deleted file mode 100644 index eb675f45..00000000 --- a/realtime/node_modules/express/node_modules/fresh/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "fresh", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "HTTP response freshness testing", - "version": "0.2.0", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/node-fresh.git" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "readme": "\n# node-fresh\n\n HTTP response freshness testing\n\n## fresh(req, res)\n\n Check freshness of `req` and `res` headers.\n\n When the cache is \"fresh\" __true__ is returned,\n otherwise __false__ is returned to indicate that\n the cache is now stale.\n\n## Example:\n\n```js\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'luna' };\nfresh(req, res);\n// => false\n\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'tobi' };\nfresh(req, res);\n// => true\n```\n\n## Installation\n\n```\n$ npm install fresh\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "_id": "fresh@0.2.0", - "dist": { - "shasum": "8ed184bd05f8b23f122ac0c2f16de9e570cea06b" - }, - "_from": "fresh@0.2.0", - "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.2.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/merge-descriptors/.npmignore b/realtime/node_modules/express/node_modules/merge-descriptors/.npmignore deleted file mode 100644 index f62e6050..00000000 --- a/realtime/node_modules/express/node_modules/merge-descriptors/.npmignore +++ /dev/null @@ -1,59 +0,0 @@ -# Compiled source # -################### -*.com -*.class -*.dll -*.exe -*.o -*.so - -# Packages # -############ -# it's better to unpack these files and commit the raw source -# git has its own built in compression methods -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip - -# Logs and databases # -###################### -*.log -*.sql -*.sqlite - -# OS generated files # -###################### -.DS_Store* -ehthumbs.db -Icon? -Thumbs.db - -# Node.js # -########### -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -node_modules -npm-debug.log - -# Components # -############## - -/build -/components -/vendors \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/merge-descriptors/README.md b/realtime/node_modules/express/node_modules/merge-descriptors/README.md deleted file mode 100644 index 34d715df..00000000 --- a/realtime/node_modules/express/node_modules/merge-descriptors/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Merge Descriptors [![Build Status](https://travis-ci.org/jonathanong/merge-descriptors.png)](https://travis-ci.org/jonathanong/merge-descriptors) - -Merge objects using descriptors. - -```js -var thing = { - get name() { - return 'jon' - } -} - -var animal = { - -} - -merge(animal, thing) - -animal.name === 'jon' -``` - -## API - -### merge(destination, source) - -Overwrites `destination`'s descriptors with `source`'s. - -## License - -The MIT License (MIT) - -Copyright (c) 2013 Jonathan Ong me@jongleberry.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/merge-descriptors/component.json b/realtime/node_modules/express/node_modules/merge-descriptors/component.json deleted file mode 100644 index 26b1b8e8..00000000 --- a/realtime/node_modules/express/node_modules/merge-descriptors/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "merge-descriptors", - "description": "Merge objects using descriptors", - "version": "0.0.1", - "scripts": [ - "index.js" - ], - "repo": "jonathanong/merge-descriptors", - "license": "MIT" -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/merge-descriptors/index.js b/realtime/node_modules/express/node_modules/merge-descriptors/index.js deleted file mode 100644 index e4e23793..00000000 --- a/realtime/node_modules/express/node_modules/merge-descriptors/index.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function (dest, src) { - Object.getOwnPropertyNames(src).forEach(function (name) { - var descriptor = Object.getOwnPropertyDescriptor(src, name) - Object.defineProperty(dest, name, descriptor) - }) - - return dest -} \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/merge-descriptors/package.json b/realtime/node_modules/express/node_modules/merge-descriptors/package.json deleted file mode 100644 index c18d515f..00000000 --- a/realtime/node_modules/express/node_modules/merge-descriptors/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "merge-descriptors", - "description": "Merge objects using descriptors", - "version": "0.0.1", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/jonathanong/merge-descriptors.git" - }, - "bugs": { - "mail": "me@jongleberry.com", - "url": "https://github.com/jonathanong/merge-descriptors/issues" - }, - "scripts": { - "test": "make test;" - }, - "readme": "# Merge Descriptors [![Build Status](https://travis-ci.org/jonathanong/merge-descriptors.png)](https://travis-ci.org/jonathanong/merge-descriptors)\n\nMerge objects using descriptors.\n\n```js\nvar thing = {\n get name() {\n return 'jon'\n }\n}\n\nvar animal = {\n\n}\n\nmerge(animal, thing)\n\nanimal.name === 'jon'\n```\n\n## API\n\n### merge(destination, source)\n\nOverwrites `destination`'s descriptors with `source`'s.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2013 Jonathan Ong me@jongleberry.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.", - "readmeFilename": "README.md", - "_id": "merge-descriptors@0.0.1", - "dist": { - "shasum": "0ba3fd59783848bd46ee4dc8f8b2b524b5ba5ae4" - }, - "_from": "merge-descriptors@0.0.1", - "_resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-0.0.1.tgz" -} diff --git a/realtime/node_modules/express/node_modules/methods/History.md b/realtime/node_modules/express/node_modules/methods/History.md deleted file mode 100644 index 1d0e229f..00000000 --- a/realtime/node_modules/express/node_modules/methods/History.md +++ /dev/null @@ -1,5 +0,0 @@ - -0.1.0 / 2013-10-28 -================== - - * add http.METHODS support diff --git a/realtime/node_modules/express/node_modules/methods/Readme.md b/realtime/node_modules/express/node_modules/methods/Readme.md deleted file mode 100644 index ac0658e2..00000000 --- a/realtime/node_modules/express/node_modules/methods/Readme.md +++ /dev/null @@ -1,4 +0,0 @@ - -# Methods - - HTTP verbs that node core's parser supports. diff --git a/realtime/node_modules/express/node_modules/methods/index.js b/realtime/node_modules/express/node_modules/methods/index.js deleted file mode 100644 index 95b93f5f..00000000 --- a/realtime/node_modules/express/node_modules/methods/index.js +++ /dev/null @@ -1,37 +0,0 @@ - -var http = require('http'); - -if (http.METHODS) { - module.exports = http.METHODS.map(function(method){ - return method.toLowerCase(); - }); - - return; -} - -module.exports = [ - 'get', - 'post', - 'put', - 'head', - 'delete', - 'options', - 'trace', - 'copy', - 'lock', - 'mkcol', - 'move', - 'propfind', - 'proppatch', - 'unlock', - 'report', - 'mkactivity', - 'checkout', - 'merge', - 'm-search', - 'notify', - 'subscribe', - 'unsubscribe', - 'patch', - 'search' -]; diff --git a/realtime/node_modules/express/node_modules/methods/package.json b/realtime/node_modules/express/node_modules/methods/package.json deleted file mode 100644 index 407c5700..00000000 --- a/realtime/node_modules/express/node_modules/methods/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "methods", - "version": "0.1.0", - "description": "HTTP methods that node supports", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "http", - "methods" - ], - "author": { - "name": "TJ Holowaychuk" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/node-methods.git" - }, - "readme": "\n# Methods\n\n HTTP verbs that node core's parser supports.\n", - "readmeFilename": "Readme.md", - "_id": "methods@0.1.0", - "dist": { - "shasum": "c4649cfe2de1d509524a20c84dd06394280ef8d2" - }, - "_from": "methods@0.1.0", - "_resolved": "https://registry.npmjs.org/methods/-/methods-0.1.0.tgz" -} diff --git a/realtime/node_modules/express/node_modules/mkdirp/.npmignore b/realtime/node_modules/express/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c347..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/mkdirp/.travis.yml b/realtime/node_modules/express/node_modules/mkdirp/.travis.yml deleted file mode 100644 index 84fd7ca2..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - 0.9 diff --git a/realtime/node_modules/express/node_modules/mkdirp/LICENSE b/realtime/node_modules/express/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1aeb..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/mkdirp/examples/pow.js b/realtime/node_modules/express/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e6924212..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/index.js b/realtime/node_modules/express/node_modules/mkdirp/index.js deleted file mode 100644 index fda6de8a..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/index.js +++ /dev/null @@ -1,82 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, mode, f, made) { - if (typeof mode === 'function' || mode === undefined) { - f = mode; - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - fs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), mode, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, mode, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - fs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, mode, made) { - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - try { - fs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), mode, made); - sync(p, mode, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = fs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/realtime/node_modules/express/node_modules/mkdirp/package.json b/realtime/node_modules/express/node_modules/mkdirp/package.json deleted file mode 100644 index 70918597..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.5", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "main": "./index", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "http://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "license": "MIT", - "readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n \nmkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, mode, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\n## mkdirp.sync(dir, mode)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\n# license\n\nMIT\n", - "readmeFilename": "readme.markdown", - "_id": "mkdirp@0.3.5", - "dist": { - "shasum": "022350c83d33be2796bd255202861e63386a158a" - }, - "_from": "mkdirp@0.3.5", - "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz" -} diff --git a/realtime/node_modules/express/node_modules/mkdirp/readme.markdown b/realtime/node_modules/express/node_modules/mkdirp/readme.markdown deleted file mode 100644 index 83b0216a..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,63 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, mode, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -## mkdirp.sync(dir, mode) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -Returns the first directory that had to be created, if any. - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -# license - -MIT diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/chmod.js b/realtime/node_modules/express/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8e..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = 0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = 0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/clobber.js b/realtime/node_modules/express/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb70998..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, 0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/mkdirp.js b/realtime/node_modules/express/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index b07cd70c..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('woo', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/perm.js b/realtime/node_modules/express/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 23a7abbd..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('async perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/perm_sync.js b/realtime/node_modules/express/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f685f609..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,39 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); - -test('sync root perm', function (t) { - t.plan(1); - - var file = '/tmp'; - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/race.js b/realtime/node_modules/express/node_modules/mkdirp/test/race.js deleted file mode 100644 index 96a04476..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,41 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('race', function (t) { - t.plan(4); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); - - mk(file, function () { - if (--res === 0) t.end(); - }); - - function mk (file, cb) { - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); - } - }) - }) - }); - } -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/rel.js b/realtime/node_modules/express/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 79858243..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('rel', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/return.js b/realtime/node_modules/express/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e56..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/return_sync.js b/realtime/node_modules/express/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d35..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/root.js b/realtime/node_modules/express/node_modules/mkdirp/test/root.js deleted file mode 100644 index 97ad7a2f..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,18 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('root', function (t) { - // '/' on unix, 'c:/' on windows. - var file = path.resolve('/'); - - mkdirp(file, 0755, function (err) { - if (err) throw err - fs.stat(file, function (er, stat) { - if (er) throw er - t.ok(stat.isDirectory(), 'target is a directory'); - t.end(); - }) - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/sync.js b/realtime/node_modules/express/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 7530cada..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/umask.js b/realtime/node_modules/express/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 64ccafe2..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('implicit mode from umask', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/realtime/node_modules/express/node_modules/mkdirp/test/umask_sync.js b/realtime/node_modules/express/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 35bd5cbb..00000000 --- a/realtime/node_modules/express/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('umask sync modes', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/realtime/node_modules/express/node_modules/range-parser/.npmignore b/realtime/node_modules/express/node_modules/range-parser/.npmignore deleted file mode 100644 index 9daeafb9..00000000 --- a/realtime/node_modules/express/node_modules/range-parser/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/realtime/node_modules/express/node_modules/range-parser/History.md b/realtime/node_modules/express/node_modules/range-parser/History.md deleted file mode 100644 index 82df7b1e..00000000 --- a/realtime/node_modules/express/node_modules/range-parser/History.md +++ /dev/null @@ -1,15 +0,0 @@ - -0.0.4 / 2012-06-17 -================== - - * changed: ret -1 for unsatisfiable and -2 when invalid - -0.0.3 / 2012-06-17 -================== - - * fix last-byte-pos default to len - 1 - -0.0.2 / 2012-06-14 -================== - - * add `.type` diff --git a/realtime/node_modules/express/node_modules/range-parser/Makefile b/realtime/node_modules/express/node_modules/range-parser/Makefile deleted file mode 100644 index 8e8640f2..00000000 --- a/realtime/node_modules/express/node_modules/range-parser/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --reporter spec \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/range-parser/Readme.md b/realtime/node_modules/express/node_modules/range-parser/Readme.md deleted file mode 100644 index b2a67fe8..00000000 --- a/realtime/node_modules/express/node_modules/range-parser/Readme.md +++ /dev/null @@ -1,28 +0,0 @@ - -# node-range-parser - - Range header field parser. - -## Example: - -```js -assert(-1 == parse(200, 'bytes=500-20')); -assert(-2 == parse(200, 'bytes=malformed')); -parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }])); -parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }])); -parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }])); -parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }])); -parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }])); -parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }])); -parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }])); -parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }])); -parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }])); -parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }])); -parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }])); -``` - -## Installation - -``` -$ npm install range-parser -``` \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/range-parser/index.js b/realtime/node_modules/express/node_modules/range-parser/index.js deleted file mode 100644 index 9b0f7a8e..00000000 --- a/realtime/node_modules/express/node_modules/range-parser/index.js +++ /dev/null @@ -1,49 +0,0 @@ - -/** - * Parse "Range" header `str` relative to the given file `size`. - * - * @param {Number} size - * @param {String} str - * @return {Array} - * @api public - */ - -module.exports = function(size, str){ - var valid = true; - var i = str.indexOf('='); - - if (-1 == i) return -2; - - var arr = str.slice(i + 1).split(',').map(function(range){ - var range = range.split('-') - , start = parseInt(range[0], 10) - , end = parseInt(range[1], 10); - - // -nnn - if (isNaN(start)) { - start = size - end; - end = size - 1; - // nnn- - } else if (isNaN(end)) { - end = size - 1; - } - - // limit last-byte-pos to current length - if (end > size - 1) end = size - 1; - - // invalid - if (isNaN(start) - || isNaN(end) - || start > end - || start < 0) valid = false; - - return { - start: start, - end: end - }; - }); - - arr.type = str.slice(0, i); - - return valid ? arr : -1; -}; \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/range-parser/package.json b/realtime/node_modules/express/node_modules/range-parser/package.json deleted file mode 100644 index 56103c54..00000000 --- a/realtime/node_modules/express/node_modules/range-parser/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "range-parser", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "Range header field string parser", - "version": "0.0.4", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "readme": "\n# node-range-parser\n\n Range header field parser.\n\n## Example:\n\n```js\nassert(-1 == parse(200, 'bytes=500-20'));\nassert(-2 == parse(200, 'bytes=malformed'));\nparse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));\nparse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));\nparse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));\nparse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));\nparse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));\nparse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));\nparse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));\nparse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));\nparse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));\n```\n\n## Installation\n\n```\n$ npm install range-parser\n```", - "readmeFilename": "Readme.md", - "_id": "range-parser@0.0.4", - "dist": { - "shasum": "28dbcf2e97f57e5b69a77032fe2cc3f9d20c6726" - }, - "_from": "range-parser@0.0.4", - "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz" -} diff --git a/realtime/node_modules/express/node_modules/send/.npmignore b/realtime/node_modules/express/node_modules/send/.npmignore deleted file mode 100644 index f1250e58..00000000 --- a/realtime/node_modules/express/node_modules/send/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/realtime/node_modules/express/node_modules/send/History.md b/realtime/node_modules/express/node_modules/send/History.md deleted file mode 100644 index 55c4af74..00000000 --- a/realtime/node_modules/express/node_modules/send/History.md +++ /dev/null @@ -1,40 +0,0 @@ - -0.1.4 / 2013-08-11 -================== - - * update fresh - -0.1.3 / 2013-07-08 -================== - - * Revert "Fix fd leak" - -0.1.2 / 2013-07-03 -================== - - * Fix fd leak - -0.1.0 / 2012-08-25 -================== - - * add options parameter to send() that is passed to fs.createReadStream() [kanongil] - -0.0.4 / 2012-08-16 -================== - - * allow custom "Accept-Ranges" definition - -0.0.3 / 2012-07-16 -================== - - * fix normalization of the root directory. Closes #3 - -0.0.2 / 2012-07-09 -================== - - * add passing of req explicitly for now (YUCK) - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/express/node_modules/send/Makefile b/realtime/node_modules/express/node_modules/send/Makefile deleted file mode 100644 index a9dcfd50..00000000 --- a/realtime/node_modules/express/node_modules/send/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec \ - --bail - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/send/Readme.md b/realtime/node_modules/express/node_modules/send/Readme.md deleted file mode 100644 index ea7b2341..00000000 --- a/realtime/node_modules/express/node_modules/send/Readme.md +++ /dev/null @@ -1,128 +0,0 @@ -# send - - Send is Connect's `static()` extracted for generalized use, a streaming static file - server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework. - -## Installation - - $ npm install send - -## Examples - - Small: - -```js -var http = require('http'); -var send = require('send'); - -var app = http.createServer(function(req, res){ - send(req, req.url).pipe(res); -}).listen(3000); -``` - - Serving from a root directory with custom error-handling: - -```js -var http = require('http'); -var send = require('send'); -var url = require('url'); - -var app = http.createServer(function(req, res){ - // your custom error-handling logic: - function error(err) { - res.statusCode = err.status || 500; - res.end(err.message); - } - - // your custom directory handling logic: - function redirect() { - res.statusCode = 301; - res.setHeader('Location', req.url + '/'); - res.end('Redirecting to ' + req.url + '/'); - } - - // transfer arbitrary files from within - // /www/example.com/public/* - send(req, url.parse(req.url).pathname) - .root('/www/example.com/public') - .on('error', error) - .on('directory', redirect) - .pipe(res); -}).listen(3000); -``` - -## API - -### Events - - - `error` an error occurred `(err)` - - `directory` a directory was requested - - `file` a file was requested `(path, stat)` - - `stream` file streaming has started `(stream)` - - `end` streaming has completed - -### .root(dir) - - Serve files relative to `path`. Aliased as `.from(dir)`. - -### .index(path) - - By default send supports "index.html" files, to disable this - invoke `.index(false)` or to supply a new index pass a string. - -### .maxage(ms) - - Provide a max-age in milliseconds for http caching, defaults to 0. - -### .hidden(bool) - - Enable or disable transfer of hidden files, defaults to false. - -## Error-handling - - By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc. - -## Caching - - It does _not_ perform internal caching, you should use a reverse proxy cache such - as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;). - -## Debugging - - To enable `debug()` instrumentation output export __DEBUG__: - -``` -$ DEBUG=send node app -``` - -## Running tests - -``` -$ npm install -$ make test -``` - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/express/node_modules/send/index.js b/realtime/node_modules/express/node_modules/send/index.js deleted file mode 100644 index f17158d8..00000000 --- a/realtime/node_modules/express/node_modules/send/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/send'); \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/send/lib/send.js b/realtime/node_modules/express/node_modules/send/lib/send.js deleted file mode 100644 index a3d94a69..00000000 --- a/realtime/node_modules/express/node_modules/send/lib/send.js +++ /dev/null @@ -1,474 +0,0 @@ - -/** - * Module dependencies. - */ - -var debug = require('debug')('send') - , parseRange = require('range-parser') - , Stream = require('stream') - , mime = require('mime') - , fresh = require('fresh') - , path = require('path') - , http = require('http') - , fs = require('fs') - , basename = path.basename - , normalize = path.normalize - , join = path.join - , utils = require('./utils'); - -/** - * Expose `send`. - */ - -exports = module.exports = send; - -/** - * Expose mime module. - */ - -exports.mime = mime; - -/** - * Return a `SendStream` for `req` and `path`. - * - * @param {Request} req - * @param {String} path - * @param {Object} options - * @return {SendStream} - * @api public - */ - -function send(req, path, options) { - return new SendStream(req, path, options); -} - -/** - * Initialize a `SendStream` with the given `path`. - * - * Events: - * - * - `error` an error occurred - * - `stream` file streaming has started - * - `end` streaming has completed - * - `directory` a directory was requested - * - * @param {Request} req - * @param {String} path - * @param {Object} options - * @api private - */ - -function SendStream(req, path, options) { - var self = this; - this.req = req; - this.path = path; - this.options = options || {}; - this.maxage(0); - this.hidden(false); - this.index('index.html'); -} - -/** - * Inherits from `Stream.prototype`. - */ - -SendStream.prototype.__proto__ = Stream.prototype; - -/** - * Enable or disable "hidden" (dot) files. - * - * @param {Boolean} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.hidden = function(val){ - debug('hidden %s', val); - this._hidden = val; - return this; -}; - -/** - * Set index `path`, set to a falsy - * value to disable index support. - * - * @param {String|Boolean} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.index = function(path){ - debug('index %s', path); - this._index = path; - return this; -}; - -/** - * Set root `path`. - * - * @param {String} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.root = -SendStream.prototype.from = function(path){ - this._root = normalize(path); - return this; -}; - -/** - * Set max-age to `ms`. - * - * @param {Number} ms - * @return {SendStream} - * @api public - */ - -SendStream.prototype.maxage = function(ms){ - if (Infinity == ms) ms = 60 * 60 * 24 * 365 * 1000; - debug('max-age %d', ms); - this._maxage = ms; - return this; -}; - -/** - * Emit error with `status`. - * - * @param {Number} status - * @api private - */ - -SendStream.prototype.error = function(status, err){ - var res = this.res; - var msg = http.STATUS_CODES[status]; - err = err || new Error(msg); - err.status = status; - if (this.listeners('error').length) return this.emit('error', err); - res.statusCode = err.status; - res.end(msg); -}; - -/** - * Check if the pathname is potentially malicious. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isMalicious = function(){ - return !this._root && ~this.path.indexOf('..'); -}; - -/** - * Check if the pathname ends with "/". - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.hasTrailingSlash = function(){ - return '/' == this.path[this.path.length - 1]; -}; - -/** - * Check if the basename leads with ".". - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.hasLeadingDot = function(){ - return '.' == basename(this.path)[0]; -}; - -/** - * Check if this is a conditional GET request. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isConditionalGET = function(){ - return this.req.headers['if-none-match'] - || this.req.headers['if-modified-since']; -}; - -/** - * Strip content-* header fields. - * - * @api private - */ - -SendStream.prototype.removeContentHeaderFields = function(){ - var res = this.res; - Object.keys(res._headers).forEach(function(field){ - if (0 == field.indexOf('content')) { - res.removeHeader(field); - } - }); -}; - -/** - * Respond with 304 not modified. - * - * @api private - */ - -SendStream.prototype.notModified = function(){ - var res = this.res; - debug('not modified'); - this.removeContentHeaderFields(); - res.statusCode = 304; - res.end(); -}; - -/** - * Check if the request is cacheable, aka - * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isCachable = function(){ - var res = this.res; - return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode; -}; - -/** - * Handle stat() error. - * - * @param {Error} err - * @api private - */ - -SendStream.prototype.onStatError = function(err){ - var notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR']; - if (~notfound.indexOf(err.code)) return this.error(404, err); - this.error(500, err); -}; - -/** - * Check if the cache is fresh. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isFresh = function(){ - return fresh(this.req.headers, this.res._headers); -}; - -/** - * Redirect to `path`. - * - * @param {String} path - * @api private - */ - -SendStream.prototype.redirect = function(path){ - if (this.listeners('directory').length) return this.emit('directory'); - var res = this.res; - path += '/'; - res.statusCode = 301; - res.setHeader('Location', path); - res.end('Redirecting to ' + utils.escape(path)); -}; - -/** - * Pipe to `res. - * - * @param {Stream} res - * @return {Stream} res - * @api public - */ - -SendStream.prototype.pipe = function(res){ - var self = this - , args = arguments - , path = this.path - , root = this._root; - - // references - this.res = res; - - // invalid request uri - path = utils.decode(path); - if (-1 == path) return this.error(400); - - // null byte(s) - if (~path.indexOf('\0')) return this.error(400); - - // join / normalize from optional root dir - if (root) path = normalize(join(this._root, path)); - - // ".." is malicious without "root" - if (this.isMalicious()) return this.error(403); - - // malicious path - if (root && 0 != path.indexOf(root)) return this.error(403); - - // hidden file support - if (!this._hidden && this.hasLeadingDot()) return this.error(404); - - // index file support - if (this._index && this.hasTrailingSlash()) path += this._index; - - debug('stat "%s"', path); - fs.stat(path, function(err, stat){ - if (err) return self.onStatError(err); - if (stat.isDirectory()) return self.redirect(self.path); - self.emit('file', path, stat); - self.send(path, stat); - }); - - return res; -}; - -/** - * Transfer `path`. - * - * @param {String} path - * @api public - */ - -SendStream.prototype.send = function(path, stat){ - var options = this.options; - var len = stat.size; - var res = this.res; - var req = this.req; - var ranges = req.headers.range; - var offset = options.start || 0; - - // set header fields - this.setHeader(stat); - - // set content-type - this.type(path); - - // conditional GET support - if (this.isConditionalGET() - && this.isCachable() - && this.isFresh()) { - return this.notModified(); - } - - // adjust len to start/end options - len = Math.max(0, len - offset); - if (options.end !== undefined) { - var bytes = options.end - offset + 1; - if (len > bytes) len = bytes; - } - - // Range support - if (ranges) { - ranges = parseRange(len, ranges); - - // unsatisfiable - if (-1 == ranges) { - res.setHeader('Content-Range', 'bytes */' + stat.size); - return this.error(416); - } - - // valid (syntactically invalid ranges are treated as a regular response) - if (-2 != ranges) { - options.start = offset + ranges[0].start; - options.end = offset + ranges[0].end; - - // Content-Range - res.statusCode = 206; - res.setHeader('Content-Range', 'bytes ' - + ranges[0].start - + '-' - + ranges[0].end - + '/' - + len); - len = options.end - options.start + 1; - } - } - - // content-length - res.setHeader('Content-Length', len); - - // HEAD support - if ('HEAD' == req.method) return res.end(); - - this.stream(path, options); -}; - -/** - * Stream `path` to the response. - * - * @param {String} path - * @param {Object} options - * @api private - */ - -SendStream.prototype.stream = function(path, options){ - // TODO: this is all lame, refactor meeee - var self = this; - var res = this.res; - var req = this.req; - - // pipe - var stream = fs.createReadStream(path, options); - this.emit('stream', stream); - stream.pipe(res); - - // socket closed, done with the fd - req.on('close', stream.destroy.bind(stream)); - - // error handling code-smell - stream.on('error', function(err){ - // no hope in responding - if (res._header) { - console.error(err.stack); - req.destroy(); - return; - } - - // 500 - err.status = 500; - self.emit('error', err); - }); - - // end - stream.on('end', function(){ - self.emit('end'); - }); -}; - -/** - * Set content-type based on `path` - * if it hasn't been explicitly set. - * - * @param {String} path - * @api private - */ - -SendStream.prototype.type = function(path){ - var res = this.res; - if (res.getHeader('Content-Type')) return; - var type = mime.lookup(path); - var charset = mime.charsets.lookup(type); - debug('content-type %s', type); - res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); -}; - -/** - * Set reaponse header fields, most - * fields may be pre-defined. - * - * @param {Object} stat - * @api private - */ - -SendStream.prototype.setHeader = function(stat){ - var res = this.res; - if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes'); - if (!res.getHeader('ETag')) res.setHeader('ETag', utils.etag(stat)); - if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); - if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (this._maxage / 1000)); - if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString()); -}; diff --git a/realtime/node_modules/express/node_modules/send/lib/utils.js b/realtime/node_modules/express/node_modules/send/lib/utils.js deleted file mode 100644 index 950e5a2c..00000000 --- a/realtime/node_modules/express/node_modules/send/lib/utils.js +++ /dev/null @@ -1,47 +0,0 @@ - -/** - * Return an ETag in the form of `"-"` - * from the given `stat`. - * - * @param {Object} stat - * @return {String} - * @api private - */ - -exports.etag = function(stat) { - return '"' + stat.size + '-' + Number(stat.mtime) + '"'; -}; - -/** - * decodeURIComponent. - * - * Allows V8 to only deoptimize this fn instead of all - * of send(). - * - * @param {String} path - * @api private - */ - -exports.decode = function(path){ - try { - return decodeURIComponent(path); - } catch (err) { - return -1; - } -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; \ No newline at end of file diff --git a/realtime/node_modules/express/node_modules/send/node_modules/mime/LICENSE b/realtime/node_modules/express/node_modules/send/node_modules/mime/LICENSE deleted file mode 100644 index 451fc455..00000000 --- a/realtime/node_modules/express/node_modules/send/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/realtime/node_modules/express/node_modules/send/node_modules/mime/README.md b/realtime/node_modules/express/node_modules/send/node_modules/mime/README.md deleted file mode 100644 index 6ca19bd1..00000000 --- a/realtime/node_modules/express/node_modules/send/node_modules/mime/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# mime - -Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community. - -## Install - -Install with [npm](http://github.com/isaacs/npm): - - npm install mime - -## API - Queries - -### mime.lookup(path) -Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g. - - var mime = require('mime'); - - mime.lookup('/path/to/file.txt'); // => 'text/plain' - mime.lookup('file.txt'); // => 'text/plain' - mime.lookup('.TXT'); // => 'text/plain' - mime.lookup('htm'); // => 'text/html' - -### mime.default_type -Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.) - -### mime.extension(type) -Get the default extension for `type` - - mime.extension('text/html'); // => 'html' - mime.extension('application/octet-stream'); // => 'bin' - -### mime.charsets.lookup() - -Map mime-type to charset - - mime.charsets.lookup('text/plain'); // => 'UTF-8' - -(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) - -## API - Defining Custom Types - -The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types). - -### mime.define() - -Add custom mime/extension mappings - - mime.define({ - 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], - 'application/x-my-type': ['x-mt', 'x-mtt'], - // etc ... - }); - - mime.lookup('x-sft'); // => 'text/x-some-format' - -The first entry in the extensions array is returned by `mime.extension()`. E.g. - - mime.extension('text/x-some-format'); // => 'x-sf' - -### mime.load(filepath) - -Load mappings from an Apache ".types" format file - - mime.load('./my_project.types'); - -The .types file format is simple - See the `types` dir for examples. diff --git a/realtime/node_modules/express/node_modules/send/node_modules/mime/mime.js b/realtime/node_modules/express/node_modules/send/node_modules/mime/mime.js deleted file mode 100644 index 48be0c5e..00000000 --- a/realtime/node_modules/express/node_modules/send/node_modules/mime/mime.js +++ /dev/null @@ -1,114 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -function Mime() { - // Map of extension -> mime type - this.types = Object.create(null); - - // Map of mime type -> extension - this.extensions = Object.create(null); -} - -/** - * Define mimetype -> extension mappings. Each key is a mime-type that maps - * to an array of extensions associated with the type. The first extension is - * used as the default extension for the type. - * - * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); - * - * @param map (Object) type definitions - */ -Mime.prototype.define = function (map) { - for (var type in map) { - var exts = map[type]; - - for (var i = 0; i < exts.length; i++) { - if (process.env.DEBUG_MIME && this.types[exts]) { - console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' + - this.types[exts] + ' to ' + type); - } - - this.types[exts[i]] = type; - } - - // Default extension is the first one we encounter - if (!this.extensions[type]) { - this.extensions[type] = exts[0]; - } - } -}; - -/** - * Load an Apache2-style ".types" file - * - * This may be called multiple times (it's expected). Where files declare - * overlapping types/extensions, the last file wins. - * - * @param file (String) path of file to load. - */ -Mime.prototype.load = function(file) { - - this._loading = file; - // Read file and split into lines - var map = {}, - content = fs.readFileSync(file, 'ascii'), - lines = content.split(/[\r\n]+/); - - lines.forEach(function(line) { - // Clean up whitespace/comments, and split into fields - var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); - map[fields.shift()] = fields; - }); - - this.define(map); - - this._loading = null; -}; - -/** - * Lookup a mime type based on extension - */ -Mime.prototype.lookup = function(path, fallback) { - var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase(); - - return this.types[ext] || fallback || this.default_type; -}; - -/** - * Return file extension associated with a mime type - */ -Mime.prototype.extension = function(mimeType) { - var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase(); - return this.extensions[type]; -}; - -// Default instance -var mime = new Mime(); - -// Load local copy of -// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -mime.load(path.join(__dirname, 'types/mime.types')); - -// Load additional types from node.js community -mime.load(path.join(__dirname, 'types/node.types')); - -// Default type -mime.default_type = mime.lookup('bin'); - -// -// Additional API specific to the default instance -// - -mime.Mime = Mime; - -/** - * Lookup a charset based on mime type. - */ -mime.charsets = { - lookup: function(mimeType, fallback) { - // Assume text types are utf8 - return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; - } -}; - -module.exports = mime; diff --git a/realtime/node_modules/express/node_modules/send/node_modules/mime/package.json b/realtime/node_modules/express/node_modules/send/node_modules/mime/package.json deleted file mode 100644 index 1644767f..00000000 --- a/realtime/node_modules/express/node_modules/send/node_modules/mime/package.json +++ /dev/null @@ -1,32 +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": {}, - "keywords": [ - "util", - "mime" - ], - "main": "mime.js", - "name": "mime", - "repository": { - "url": "https://github.com/broofa/node-mime", - "type": "git" - }, - "version": "1.2.11", - "readme": "# mime\n\nComprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.TXT'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.default_type\nSets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)\n\n### mime.extension(type)\nGet the default extension for `type`\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup()\n\nMap mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Defining Custom Types\n\nThe following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types).\n\n### mime.define()\n\nAdd custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n\nThe first entry in the extensions array is returned by `mime.extension()`. E.g.\n\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath)\n\nLoad mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n\nThe .types file format is simple - See the `types` dir for examples.\n", - "readmeFilename": "README.md", - "_id": "mime@1.2.11", - "_from": "mime@~1.2.9" -} diff --git a/realtime/node_modules/express/node_modules/send/node_modules/mime/test.js b/realtime/node_modules/express/node_modules/send/node_modules/mime/test.js deleted file mode 100644 index 2cda1c7a..00000000 --- a/realtime/node_modules/express/node_modules/send/node_modules/mime/test.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Usage: node test.js - */ - -var mime = require('./mime'); -var assert = require('assert'); -var path = require('path'); - -function eq(a, b) { - console.log('Test: ' + a + ' === ' + b); - assert.strictEqual.apply(null, arguments); -} - -console.log(Object.keys(mime.extensions).length + ' types'); -console.log(Object.keys(mime.types).length + ' extensions\n'); - -// -// Test mime lookups -// - -eq('text/plain', mime.lookup('text.txt')); // normal file -eq('text/plain', mime.lookup('TEXT.TXT')); // uppercase -eq('text/plain', mime.lookup('dir/text.txt')); // dir + file -eq('text/plain', mime.lookup('.text.txt')); // hidden file -eq('text/plain', mime.lookup('.txt')); // nameless -eq('text/plain', mime.lookup('txt')); // extension-only -eq('text/plain', mime.lookup('/txt')); // extension-less () -eq('text/plain', mime.lookup('\\txt')); // Windows, extension-less -eq('application/octet-stream', mime.lookup('text.nope')); // unrecognized -eq('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default - -// -// Test extensions -// - -eq('txt', mime.extension(mime.types.text)); -eq('html', mime.extension(mime.types.htm)); -eq('bin', mime.extension('application/octet-stream')); -eq('bin', mime.extension('application/octet-stream ')); -eq('html', mime.extension(' text/html; charset=UTF-8')); -eq('html', mime.extension('text/html; charset=UTF-8 ')); -eq('html', mime.extension('text/html; charset=UTF-8')); -eq('html', mime.extension('text/html ; charset=UTF-8')); -eq('html', mime.extension('text/html;charset=UTF-8')); -eq('html', mime.extension('text/Html;charset=UTF-8')); -eq(undefined, mime.extension('unrecognized')); - -// -// Test node.types lookups -// - -eq('application/font-woff', mime.lookup('file.woff')); -eq('application/octet-stream', mime.lookup('file.buffer')); -eq('audio/mp4', mime.lookup('file.m4a')); -eq('font/opentype', mime.lookup('file.otf')); - -// -// Test charsets -// - -eq('UTF-8', mime.charsets.lookup('text/plain')); -eq(undefined, mime.charsets.lookup(mime.types.js)); -eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); - -// -// Test for overlaps between mime.types and node.types -// - -var apacheTypes = new mime.Mime(), nodeTypes = new mime.Mime(); -apacheTypes.load(path.join(__dirname, 'types/mime.types')); -nodeTypes.load(path.join(__dirname, 'types/node.types')); - -var keys = [].concat(Object.keys(apacheTypes.types)) - .concat(Object.keys(nodeTypes.types)); -keys.sort(); -for (var i = 1; i < keys.length; i++) { - if (keys[i] == keys[i-1]) { - console.warn('Warning: ' + - 'node.types defines ' + keys[i] + '->' + nodeTypes.types[keys[i]] + - ', mime.types defines ' + keys[i] + '->' + apacheTypes.types[keys[i]]); - } -} - -console.log('\nOK'); diff --git a/realtime/node_modules/express/node_modules/send/node_modules/mime/types/mime.types b/realtime/node_modules/express/node_modules/send/node_modules/mime/types/mime.types deleted file mode 100644 index da8cd691..00000000 --- a/realtime/node_modules/express/node_modules/send/node_modules/mime/types/mime.types +++ /dev/null @@ -1,1588 +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 . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/calendar+xml -# application/cals-1840 -# application/ccmp+xml -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -application/docbook+xml dbk -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -application/gml+xml gml -application/gpx+xml gpx -application/gxf gxf -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -application/inkml+xml ink inkml -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -application/jsonml+json jsonml -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink+xml metalink -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/omdoc+xml omdoc -application/onenote onetoc onetoc2 onetmp onepkg -application/oxps oxps -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rpki-ghostbusters gbr -application/rpki-manifest mft -application/rpki-roa roa -# application/rpki-updown -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssdl+xml ssdl -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vcard+xml -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.formscentral.fcdt fcdt -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.astraea-software.iota iota -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.collection+json -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -# application/vnd.curl -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.dart dart -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.dece.zip uvz uvvz -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.ds-keypoint kpxx -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -# application/vnd.eprints.data+xml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -# application/vnd.hal+json -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -# application/vnd.hzn-3d-crossword -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -# application/vnd.innopath.wamp.notification -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.newsmessage+xml -# application/vnd.iptc.g2.packageitem+xml -# application/vnd.iptc.g2.planningitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -# application/vnd.ms-color.iccprofile -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -# application/vnd.ms-opentype -# application/vnd.ms-package.obfuscated-opentype -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -# application/vnd.ms-printing.printticket+xml -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -application/vnd.mynfc taglet -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.nitf ntf nitf -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oftn.l10n+json -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-feature-handler+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.cab-user-prefs+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.pal+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -application/vnd.osgi.subsystem esa -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.rn-realmedia-vbr rmvb -application/vnd.route66.link66+xml link66 -# application/vnd.rs-274x -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.package smzip -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tcpdump.pcap pcap cap dmp -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.through-ngn -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -# application/x-amf -application/x-apple-diskimage dmg -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-blorb blb blorb -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cbr cbr cba cbt cbz cb7 -application/x-cdlink vcd -application/x-cfs-compressed cfs -application/x-chat chat -application/x-chess-pgn pgn -application/x-conference nsc -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-dgc-compressed dgc -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-envoy evy -application/x-eva eva -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/font-woff woff -# application/x-font-vfont -application/x-freearc arc -application/x-futuresplash spl -application/x-gca-compressed gca -application/x-glulx ulx -application/x-gnumeric gnumeric -application/x-gramps-xml gramps -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-install-instructions install -application/x-iso9660-image iso -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-lzh-compressed lzh lha -application/x-mie mie -application/x-mobipocket-ebook prc mobi -application/x-ms-application application -application/x-ms-shortcut lnk -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf wmz emf emz -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-nzb nzb -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-research-info-systems ris -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-sql sql -application/x-stuffit sit -application/x-stuffitx sitx -application/x-subrip srt -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-t3vm-image t3 -application/x-tads gam -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-tgif obj -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xliff+xml xlf -application/x-xpinstall xpi -application/x-xz xz -application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 -# application/x400-bp -application/xaml+xml xaml -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xproc+xml xpl -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dv -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/fwdred -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/ip-mr_v2.5 -# audio/isac -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -# audio/musepack -audio/ogg oga ogg spx -# audio/opus -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -audio/s3m s3m -audio/silk sil -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.dvb.file -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-caf caf -audio/x-flac flac -audio/x-matroska mka -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -# audio/x-tta -audio/x-wav wav -audio/xm xm -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/png png -image/prs.btif btif -# image/prs.pti -image/sgi sgi -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.ms-photo wdp -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-3ds 3ds -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-mrsid-image sid -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-tga tga -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -model/x3d+binary x3db x3dbz -model/x3d+vrml x3dv x3dvz -model/x3d+xml x3d x3dz -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -# text/1d-interleaved-parityfec -text/cache-manifest appcache -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -# text/fwdred -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -text/vcard vcard -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -text/vnd.dvb.subtitle sub -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-java-source java -text/x-opml opml -text/x-pascal p pas -text/x-nfo nfo -text/x-setext etx -text/x-sfv sfv -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp2t -video/mp4 mp4 mp4v mpg4 -# video/mp4v-es -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.dvb.file dvb -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-matroska mkv mk3d mks -video/x-mng mng -video/x-ms-asf asf asx -video/x-ms-vob vob -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -video/x-smv smv -x-conference/x-cooltalk ice diff --git a/realtime/node_modules/express/node_modules/send/node_modules/mime/types/node.types b/realtime/node_modules/express/node_modules/send/node_modules/mime/types/node.types deleted file mode 100644 index 55b2cf79..00000000 --- a/realtime/node_modules/express/node_modules/send/node_modules/mime/types/node.types +++ /dev/null @@ -1,77 +0,0 @@ -# What: WebVTT -# Why: To allow formats intended for marking up external text track resources. -# http://dev.w3.org/html5/webvtt/ -# Added by: niftylettuce -text/vtt vtt - -# What: Google Chrome Extension -# Why: To allow apps to (work) be served with the right content type header. -# http://codereview.chromium.org/2830017 -# Added by: niftylettuce -application/x-chrome-extension crx - -# What: HTC support -# Why: To properly render .htc files such as CSS3PIE -# Added by: niftylettuce -text/x-component htc - -# What: HTML5 application cache manifes ('.manifest' extension) -# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps -# per https://developer.mozilla.org/en/offline_resources_in_firefox -# Added by: louisremi -text/cache-manifest manifest - -# What: node binary buffer format -# Why: semi-standard extension w/in the node community -# Added by: tootallnate -application/octet-stream buffer - -# What: The "protected" MP-4 formats used by iTunes. -# Why: Required for streaming music to browsers (?) -# Added by: broofa -application/mp4 m4p -audio/mp4 m4a - -# What: Video format, Part of RFC1890 -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -video/MP2T ts - -# What: EventSource mime type -# Why: mime type of Server-Sent Events stream -# http://www.w3.org/TR/eventsource/#text-event-stream -# Added by: francois2metz -text/event-stream event-stream - -# What: Mozilla App manifest mime type -# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests -# Added by: ednapiranha -application/x-web-app-manifest+json webapp - -# What: Lua file types -# Why: Googling around shows de-facto consensus on these -# Added by: creationix (Issue #45) -text/x-lua lua -application/x-lua-bytecode luac - -# What: Markdown files, as per http://daringfireball.net/projects/markdown/syntax -# Why: http://stackoverflow.com/questions/10701983/what-is-the-mime-type-for-markdown -# Added by: avoidwork -text/x-markdown markdown md mkd - -# What: ini files -# Why: because they're just text files -# Added by: Matthew Kastor -text/plain ini - -# What: DASH Adaptive Streaming manifest -# Why: https://developer.mozilla.org/en-US/docs/DASH_Adaptive_Streaming_for_HTML_5_Video -# Added by: eelcocramer -application/dash+xml mdp - -# What: OpenType font files - http://www.microsoft.com/typography/otspec/ -# Why: Browsers usually ignore the font MIME types and sniff the content, -# but Chrome, shows a warning if OpenType fonts aren't served with -# the `font/opentype` MIME type: http://i.imgur.com/8c5RN8M.png. -# Added by: alrra -font/opentype otf diff --git a/realtime/node_modules/express/node_modules/send/package.json b/realtime/node_modules/express/node_modules/send/package.json deleted file mode 100644 index 789de722..00000000 --- a/realtime/node_modules/express/node_modules/send/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "send", - "version": "0.1.4", - "description": "Better streaming static file server with Range and conditional-GET support", - "keywords": [ - "static", - "file", - "server" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": { - "debug": "*", - "mime": "~1.2.9", - "fresh": "0.2.0", - "range-parser": "0.0.4" - }, - "devDependencies": { - "mocha": "*", - "should": "*", - "supertest": "0.0.1", - "connect": "2.x" - }, - "scripts": { - "test": "make test" - }, - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/send.git" - }, - "main": "index", - "readme": "# send\n\n Send is Connect's `static()` extracted for generalized use, a streaming static file\n server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.\n\n## Installation\n\n $ npm install send\n\n## Examples\n\n Small:\n\n```js\nvar http = require('http');\nvar send = require('send');\n\nvar app = http.createServer(function(req, res){\n send(req, req.url).pipe(res);\n}).listen(3000);\n```\n\n Serving from a root directory with custom error-handling:\n\n```js\nvar http = require('http');\nvar send = require('send');\nvar url = require('url');\n\nvar app = http.createServer(function(req, res){\n // your custom error-handling logic:\n function error(err) {\n res.statusCode = err.status || 500;\n res.end(err.message);\n }\n\n // your custom directory handling logic:\n function redirect() {\n res.statusCode = 301;\n res.setHeader('Location', req.url + '/');\n res.end('Redirecting to ' + req.url + '/');\n }\n\n // transfer arbitrary files from within\n // /www/example.com/public/*\n send(req, url.parse(req.url).pathname)\n .root('/www/example.com/public')\n .on('error', error)\n .on('directory', redirect)\n .pipe(res);\n}).listen(3000);\n```\n\n## API\n\n### Events\n\n - `error` an error occurred `(err)`\n - `directory` a directory was requested\n - `file` a file was requested `(path, stat)`\n - `stream` file streaming has started `(stream)`\n - `end` streaming has completed\n\n### .root(dir)\n\n Serve files relative to `path`. Aliased as `.from(dir)`.\n\n### .index(path)\n\n By default send supports \"index.html\" files, to disable this\n invoke `.index(false)` or to supply a new index pass a string.\n\n### .maxage(ms)\n\n Provide a max-age in milliseconds for http caching, defaults to 0.\n\n### .hidden(bool)\n\n Enable or disable transfer of hidden files, defaults to false.\n\n## Error-handling\n\n By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc.\n\n## Caching\n\n It does _not_ perform internal caching, you should use a reverse proxy cache such\n as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;).\n\n## Debugging\n\n To enable `debug()` instrumentation output export __DEBUG__:\n\n```\n$ DEBUG=send node app\n```\n\n## Running tests\n\n```\n$ npm install\n$ make test\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "send@0.1.4", - "dist": { - "shasum": "b27c692077345c00996c8e930e3fa0b60cb27cf4" - }, - "_from": "send@0.1.4", - "_resolved": "https://registry.npmjs.org/send/-/send-0.1.4.tgz" -} diff --git a/realtime/node_modules/express/package.json b/realtime/node_modules/express/package.json deleted file mode 100644 index 6fe058c5..00000000 --- a/realtime/node_modules/express/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "express", - "description": "Sinatra inspired web development framework", - "version": "3.4.8", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "Ciaran Jessup", - "email": "ciaranj@gmail.com" - }, - { - "name": "Guillermo Rauch", - "email": "rauchg@gmail.com" - } - ], - "dependencies": { - "connect": "2.12.0", - "commander": "1.3.2", - "range-parser": "0.0.4", - "mkdirp": "0.3.5", - "cookie": "0.1.0", - "buffer-crc32": "0.2.1", - "fresh": "0.2.0", - "methods": "0.1.0", - "send": "0.1.4", - "cookie-signature": "1.0.1", - "merge-descriptors": "0.0.1", - "debug": ">= 0.7.3 < 1" - }, - "devDependencies": { - "ejs": "~0.8.4", - "mocha": "~1.15.1", - "jade": "~0.30.0", - "hjs": "~0.0.6", - "stylus": "~0.40.0", - "should": "~2.1.1", - "connect-redis": "~1.4.5", - "marked": "0.2.10", - "supertest": "~0.8.1" - }, - "keywords": [ - "express", - "framework", - "sinatra", - "web", - "rest", - "restful", - "router", - "app", - "api" - ], - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/express" - }, - "main": "index", - "bin": { - "express": "./bin/express" - }, - "scripts": { - "prepublish": "npm prune", - "test": "make test" - }, - "engines": { - "node": ">= 0.8.0" - }, - "license": "MIT", - "readme": "[![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)](http://expressjs.com/)\n\n Fast, unopinionated, minimalist web framework for [node](http://nodejs.org).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Gittip](http://img.shields.io/gittip/visionmedia.png)](https://www.gittip.com/visionmedia/)\n\n```js\nvar express = require('express');\nvar app = express();\n\napp.get('/', function(req, res){\n res.send('Hello World');\n});\n\napp.listen(3000);\n```\n\n## Installation\n\n $ npm install -g express\n\n## Quick Start\n\n The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:\n\n Create the app:\n\n $ npm install -g express\n $ express /tmp/foo && cd /tmp/foo\n\n Install dependencies:\n\n $ npm install\n\n Start the server:\n\n $ node app\n\n## Features\n\n * Built on [Connect](http://github.com/senchalabs/connect)\n * Robust routing\n * HTTP helpers (redirection, caching, etc)\n * View system supporting 14+ template engines\n * Content negotiation\n * Focus on high performance\n * Environment based configuration\n * Executable for generating applications quickly\n * High test coverage\n\n## Philosophy\n\n The Express philosophy is to provide small, robust tooling for HTTP servers, making\n it a great solution for single page applications, web sites, hybrids, or public\n HTTP APIs.\n\n Built on Connect, you can use _only_ what you need, and nothing more. Applications\n can be as big or as small as you like, even a single file. Express does\n not force you to use any specific ORM or template engine. With support for over\n 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js),\n you can quickly craft your perfect framework.\n\n## More Information\n\n * [Website and Documentation](http://expressjs.com/) stored at [visionmedia/expressjs.com](https://github.com/visionmedia/expressjs.com)\n * Join #express on freenode\n * [Google Group](http://groups.google.com/group/express-js) for discussion\n * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates\n * Visit the [Wiki](http://github.com/visionmedia/express/wiki)\n * [Русскоязычная документация](http://jsman.ru/express/)\n * Run express examples [online](https://runnable.com/express)\n\n## Viewing Examples\n\nClone the Express repo, then install the dev dependencies to install all the example / test suite dependencies:\n\n $ git clone git://github.com/visionmedia/express.git --depth 1\n $ cd express\n $ npm install\n\nThen run whichever tests you want:\n\n $ node examples/content-negotiation\n\nYou can also view live examples here:\n\n\n\n## Running Tests\n\nTo run the test suite, first invoke the following command within the repo, installing the development dependencies:\n\n $ npm install\n\nThen run the tests:\n\n $ make test\n\n## Contributors\n\n https://github.com/visionmedia/express/graphs/contributors\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2009-2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "express@3.4.8", - "dist": { - "shasum": "4cbd4fad204275fc4cfee0cc7711d71f13f637e7" - }, - "_from": "express@", - "_resolved": "https://registry.npmjs.org/express/-/express-3.4.8.tgz" -} diff --git a/realtime/node_modules/redis-url/.npmignore b/realtime/node_modules/redis-url/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/realtime/node_modules/redis-url/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/realtime/node_modules/redis-url/README.md b/realtime/node_modules/redis-url/README.md deleted file mode 100644 index 9ca34f75..00000000 --- a/realtime/node_modules/redis-url/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# redis-url - -## Usage - - // use $REDIS_URL or redis://localhost:6379 - var redis = require('redis-url').connect(); - - // specify a url - var redis = require('redis-url').connect(process.env.SOMEREDIS_URL); - -## Url format - - redis://[db-number[:password]@]host:port[?option=value] -**db-number** is integer from 1 to 15 - -## License - -MIT diff --git a/realtime/node_modules/redis-url/index.js b/realtime/node_modules/redis-url/index.js deleted file mode 100644 index 88e2d7de..00000000 --- a/realtime/node_modules/redis-url/index.js +++ /dev/null @@ -1,28 +0,0 @@ -var url = require('url'); -var querystring = require('querystring'); - -module.exports.createClient = module.exports.connect = function(redis_url) { - var password, database; - var parsed_url = url.parse(redis_url || process.env.REDIS_URL || 'redis://localhost:6379'); - var parsed_auth = (parsed_url.auth || '').split(':'); - var options = querystring.parse(parsed_url.query); - - var redis = require('redis').createClient(parsed_url.port, parsed_url.hostname, options); - - if (password = parsed_auth[1]) { - redis.auth(password, function(err) { - if (err) throw err; - }); - } - - if (database = parsed_auth[0]) { - redis.select(database); - redis.on('connect', function() { - redis.send_anyways = true - redis.select(database); - redis.send_anyways = false; - }); - } - - return(redis); -} diff --git a/realtime/node_modules/redis-url/package.json b/realtime/node_modules/redis-url/package.json deleted file mode 100644 index 6b1672e4..00000000 --- a/realtime/node_modules/redis-url/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "redis-url", - "version": "0.2.0", - "description": "Use a REDIS_URL to connect to Redis", - "author": { - "name": "David Dollar", - "email": "ddollar@gmail.com" - }, - "main": "./index.js", - "dependencies": { - "redis": ">= 0.0.1" - }, - "readme": "# redis-url\n\n## Usage\n\n // use $REDIS_URL or redis://localhost:6379\n var redis = require('redis-url').connect();\n\n // specify a url\n var redis = require('redis-url').connect(process.env.SOMEREDIS_URL);\n\n## Url format\n\n redis://[db-number[:password]@]host:port[?option=value]\n**db-number** is integer from 1 to 15\n\n## License\n\nMIT\n", - "readmeFilename": "README.md", - "_id": "redis-url@0.2.0", - "dist": { - "shasum": "5c76d5e5383540ce7c49962e5b2c858236d75d45" - }, - "_from": "redis-url@", - "_resolved": "https://registry.npmjs.org/redis-url/-/redis-url-0.2.0.tgz" -} diff --git a/realtime/node_modules/redis-url/test.js b/realtime/node_modules/redis-url/test.js deleted file mode 100644 index 1ec37df0..00000000 --- a/realtime/node_modules/redis-url/test.js +++ /dev/null @@ -1,18 +0,0 @@ -var redis = require('./index').createClient(); -redis.set('foo', 'bar'); -redis.get('foo', function(err, res) { - console.log('got1: ' + res); -}); -redis.keys('*', function(err, res) { - console.log('keys1: ' + res.length); -}); - -var redis = require('./index').createClient(process.env.REDISTOGO_URL); -redis.set('foo', 'bar'); -redis.get('foo', function(err, res) { - console.log('got2: ' + res); -}); -redis.keys('*', function(err, res) { - console.log('keys2: ' + res.length); -}); - diff --git a/realtime/node_modules/redis/.npmignore b/realtime/node_modules/redis/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/realtime/node_modules/redis/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/realtime/node_modules/redis/README.md b/realtime/node_modules/redis/README.md deleted file mode 100644 index 46e7018c..00000000 --- a/realtime/node_modules/redis/README.md +++ /dev/null @@ -1,691 +0,0 @@ -redis - a node.js redis client -=========================== - -This is a complete Redis client for node.js. It supports all Redis commands, including many recently added commands like EVAL from -experimental Redis server branches. - - -Install with: - - npm install redis - -Pieter Noordhuis has provided a binding to the official `hiredis` C library, which is non-blocking and fast. To use `hiredis`, do: - - npm install hiredis redis - -If `hiredis` is installed, `node_redis` will use it by default. Otherwise, a pure JavaScript parser will be used. - -If you use `hiredis`, be sure to rebuild it whenever you upgrade your version of node. There are mysterious failures that can -happen between node and native code modules after a node upgrade. - - -## Usage - -Simple example, included as `examples/simple.js`: - -```js - var redis = require("redis"), - client = redis.createClient(); - - // if you'd like to select database 3, instead of 0 (default), call - // client.select(3, function() { /* ... */ }); - - client.on("error", function (err) { - console.log("Error " + err); - }); - - client.set("string key", "string val", redis.print); - client.hset("hash key", "hashtest 1", "some value", redis.print); - client.hset(["hash key", "hashtest 2", "some other value"], redis.print); - client.hkeys("hash key", function (err, replies) { - console.log(replies.length + " replies:"); - replies.forEach(function (reply, i) { - console.log(" " + i + ": " + reply); - }); - client.quit(); - }); -``` - -This will display: - - mjr:~/work/node_redis (master)$ node example.js - Reply: OK - Reply: 0 - Reply: 0 - 2 replies: - 0: hashtest 1 - 1: hashtest 2 - mjr:~/work/node_redis (master)$ - - -## Performance - -Here are typical results of `multi_bench.js` which is similar to `redis-benchmark` from the Redis distribution. -It uses 50 concurrent connections with no pipelining. - -JavaScript parser: - - PING: 20000 ops 42283.30 ops/sec 0/5/1.182 - SET: 20000 ops 32948.93 ops/sec 1/7/1.515 - GET: 20000 ops 28694.40 ops/sec 0/9/1.740 - INCR: 20000 ops 39370.08 ops/sec 0/8/1.269 - LPUSH: 20000 ops 36429.87 ops/sec 0/8/1.370 - LRANGE (10 elements): 20000 ops 9891.20 ops/sec 1/9/5.048 - LRANGE (100 elements): 20000 ops 1384.56 ops/sec 10/91/36.072 - -hiredis parser: - - PING: 20000 ops 46189.38 ops/sec 1/4/1.082 - SET: 20000 ops 41237.11 ops/sec 0/6/1.210 - GET: 20000 ops 39682.54 ops/sec 1/7/1.257 - INCR: 20000 ops 40080.16 ops/sec 0/8/1.242 - LPUSH: 20000 ops 41152.26 ops/sec 0/3/1.212 - LRANGE (10 elements): 20000 ops 36563.07 ops/sec 1/8/1.363 - LRANGE (100 elements): 20000 ops 21834.06 ops/sec 0/9/2.287 - -The performance of `node_redis` improves dramatically with pipelining, which happens automatically in most normal programs. - - -### Sending Commands - -Each Redis command is exposed as a function on the `client` object. -All functions take either an `args` Array plus optional `callback` Function or -a variable number of individual arguments followed by an optional callback. -Here is an example of passing an array of arguments and a callback: - - client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], function (err, res) {}); - -Here is that same call in the second style: - - client.mset("test keys 1", "test val 1", "test keys 2", "test val 2", function (err, res) {}); - -Note that in either form the `callback` is optional: - - client.set("some key", "some val"); - client.set(["some other key", "some val"]); - -If the key is missing, reply will be null (probably): - - client.get("missingkey", function(err, reply) { - // reply is null when the key is missing - console.log(reply); - }); - -For a list of Redis commands, see [Redis Command Reference](http://redis.io/commands) - -The commands can be specified in uppercase or lowercase for convenience. `client.get()` is the same as `client.GET()`. - -Minimal parsing is done on the replies. Commands that return a single line reply return JavaScript Strings, -integer replies return JavaScript Numbers, "bulk" replies return node Buffers, and "multi bulk" replies return a -JavaScript Array of node Buffers. `HGETALL` returns an Object with Buffers keyed by the hash keys. - -# API - -## Connection Events - -`client` will emit some events about the state of the connection to the Redis server. - -### "ready" - -`client` will emit `ready` a connection is established to the Redis server and the server reports -that it is ready to receive commands. Commands issued before the `ready` event are queued, -then replayed just before this event is emitted. - -### "connect" - -`client` will emit `connect` at the same time as it emits `ready` unless `client.options.no_ready_check` -is set. If this options is set, `connect` will be emitted when the stream is connected, and then -you are free to try to send commands. - -### "error" - -`client` will emit `error` when encountering an error connecting to the Redis server. - -Note that "error" is a special event type in node. If there are no listeners for an -"error" event, node will exit. This is usually what you want, but it can lead to some -cryptic error messages like this: - - mjr:~/work/node_redis (master)$ node example.js - - node.js:50 - throw e; - ^ - Error: ECONNREFUSED, Connection refused - at IOWatcher.callback (net:870:22) - at node.js:607:9 - -Not very useful in diagnosing the problem, but if your program isn't ready to handle this, -it is probably the right thing to just exit. - -`client` will also emit `error` if an exception is thrown inside of `node_redis` for whatever reason. -It would be nice to distinguish these two cases. - -### "end" - -`client` will emit `end` when an established Redis server connection has closed. - -### "drain" - -`client` will emit `drain` when the TCP connection to the Redis server has been buffering, but is now -writable. This event can be used to stream commands in to Redis and adapt to backpressure. Right now, -you need to check `client.command_queue.length` to decide when to reduce your send rate. Then you can -resume sending when you get `drain`. - -### "idle" - -`client` will emit `idle` when there are no outstanding commands that are awaiting a response. - -## redis.createClient(port, host, options) - -Create a new client connection. `port` defaults to `6379` and `host` defaults -to `127.0.0.1`. If you have `redis-server` running on the same computer as node, then the defaults for -port and host are probably fine. `options` in an object with the following possible properties: - -* `parser`: which Redis protocol reply parser to use. Defaults to `hiredis` if that module is installed. -This may also be set to `javascript`. -* `return_buffers`: defaults to `false`. If set to `true`, then all replies will be sent to callbacks as node Buffer -objects instead of JavaScript Strings. -* `detect_buffers`: default to `false`. If set to `true`, then replies will be sent to callbacks as node Buffer objects -if any of the input arguments to the original command were Buffer objects. -This option lets you switch between Buffers and Strings on a per-command basis, whereas `return_buffers` applies to -every command on a client. -* `socket_nodelay`: defaults to `true`. Whether to call setNoDelay() on the TCP stream, which disables the -Nagle algorithm on the underlying socket. Setting this option to `false` can result in additional throughput at the -cost of more latency. Most applications will want this set to `true`. -* `no_ready_check`: defaults to `false`. When a connection is established to the Redis server, the server might still -be loading the database from disk. While loading, the server not respond to any commands. To work around this, -`node_redis` has a "ready check" which sends the `INFO` command to the server. The response from the `INFO` command -indicates whether the server is ready for more commands. When ready, `node_redis` emits a `ready` event. -Setting `no_ready_check` to `true` will inhibit this check. -* `enable_offline_queue`: defaults to `true`. By default, if there is no active -connection to the redis server, commands are added to a queue and are executed -once the connection has been established. Setting `enable_offline_queue` to -`false` will disable this feature and the callback will be execute immediately -with an error, or an error will be thrown if no callback is specified. - -```js - var redis = require("redis"), - client = redis.createClient(null, null, {detect_buffers: true}); - - client.set("foo_rand000000000000", "OK"); - - // This will return a JavaScript String - client.get("foo_rand000000000000", function (err, reply) { - console.log(reply.toString()); // Will print `OK` - }); - - // This will return a Buffer since original key is specified as a Buffer - client.get(new Buffer("foo_rand000000000000"), function (err, reply) { - console.log(reply.toString()); // Will print `` - }); - client.end(); -``` - -`createClient()` returns a `RedisClient` object that is named `client` in all of the examples here. - -## client.auth(password, callback) - -When connecting to Redis servers that require authentication, the `AUTH` command must be sent as the -first command after connecting. This can be tricky to coordinate with reconnections, the ready check, -etc. To make this easier, `client.auth()` stashes `password` and will send it after each connection, -including reconnections. `callback` is invoked only once, after the response to the very first -`AUTH` command sent. -NOTE: Your call to `client.auth()` should not be inside the ready handler. If -you are doing this wrong, `client` will emit an error that looks -something like this `Error: Ready check failed: ERR operation not permitted`. - -## client.end() - -Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed. -If you want to exit cleanly, call `client.quit()` to send the `QUIT` command after you have handled all replies. - -This example closes the connection to the Redis server before the replies have been read. You probably don't -want to do this: - -```js - var redis = require("redis"), - client = redis.createClient(); - - client.set("foo_rand000000000000", "some fantastic value"); - client.get("foo_rand000000000000", function (err, reply) { - console.log(reply.toString()); - }); - client.end(); -``` - -`client.end()` is useful for timeout cases where something is stuck or taking too long and you want -to start over. - -## Friendlier hash commands - -Most Redis commands take a single String or an Array of Strings as arguments, and replies are sent back as a single String or an Array of Strings. -When dealing with hash values, there are a couple of useful exceptions to this. - -### client.hgetall(hash) - -The reply from an HGETALL command will be converted into a JavaScript Object by `node_redis`. That way you can interact -with the responses using JavaScript syntax. - -Example: - - client.hmset("hosts", "mjr", "1", "another", "23", "home", "1234"); - client.hgetall("hosts", function (err, obj) { - console.dir(obj); - }); - -Output: - - { mjr: '1', another: '23', home: '1234' } - -### client.hmset(hash, obj, [callback]) - -Multiple values in a hash can be set by supplying an object: - - client.HMSET(key2, { - "0123456789": "abcdefghij", // NOTE: the key and value must both be strings - "some manner of key": "a type of value" - }); - -The properties and values of this Object will be set as keys and values in the Redis hash. - -### client.hmset(hash, key1, val1, ... keyn, valn, [callback]) - -Multiple values may also be set by supplying a list: - - client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value"); - - -## Publish / Subscribe - -Here is a simple example of the API for publish / subscribe. This program opens two -client connections, subscribes to a channel on one of them, and publishes to that -channel on the other: - -```js - var redis = require("redis"), - client1 = redis.createClient(), client2 = redis.createClient(), - msg_count = 0; - - client1.on("subscribe", function (channel, count) { - client2.publish("a nice channel", "I am sending a message."); - client2.publish("a nice channel", "I am sending a second message."); - client2.publish("a nice channel", "I am sending my last message."); - }); - - client1.on("message", function (channel, message) { - console.log("client1 channel " + channel + ": " + message); - msg_count += 1; - if (msg_count === 3) { - client1.unsubscribe(); - client1.end(); - client2.end(); - } - }); - - client1.incr("did a thing"); - client1.subscribe("a nice channel"); -``` - -When a client issues a `SUBSCRIBE` or `PSUBSCRIBE`, that connection is put into "pub/sub" mode. -At that point, only commands that modify the subscription set are valid. When the subscription -set is empty, the connection is put back into regular mode. - -If you need to send regular commands to Redis while in pub/sub mode, just open another connection. - -## Pub / Sub Events - -If a client has subscriptions active, it may emit these events: - -### "message" (channel, message) - -Client will emit `message` for every message received that matches an active subscription. -Listeners are passed the channel name as `channel` and the message Buffer as `message`. - -### "pmessage" (pattern, channel, message) - -Client will emit `pmessage` for every message received that matches an active subscription pattern. -Listeners are passed the original pattern used with `PSUBSCRIBE` as `pattern`, the sending channel -name as `channel`, and the message Buffer as `message`. - -### "subscribe" (channel, count) - -Client will emit `subscribe` in response to a `SUBSCRIBE` command. Listeners are passed the -channel name as `channel` and the new count of subscriptions for this client as `count`. - -### "psubscribe" (pattern, count) - -Client will emit `psubscribe` in response to a `PSUBSCRIBE` command. Listeners are passed the -original pattern as `pattern`, and the new count of subscriptions for this client as `count`. - -### "unsubscribe" (channel, count) - -Client will emit `unsubscribe` in response to a `UNSUBSCRIBE` command. Listeners are passed the -channel name as `channel` and the new count of subscriptions for this client as `count`. When -`count` is 0, this client has left pub/sub mode and no more pub/sub events will be emitted. - -### "punsubscribe" (pattern, count) - -Client will emit `punsubscribe` in response to a `PUNSUBSCRIBE` command. Listeners are passed the -channel name as `channel` and the new count of subscriptions for this client as `count`. When -`count` is 0, this client has left pub/sub mode and no more pub/sub events will be emitted. - -## client.multi([commands]) - -`MULTI` commands are queued up until an `EXEC` is issued, and then all commands are run atomically by -Redis. The interface in `node_redis` is to return an individual `Multi` object by calling `client.multi()`. - -```js - var redis = require("./index"), - client = redis.createClient(), set_size = 20; - - client.sadd("bigset", "a member"); - client.sadd("bigset", "another member"); - - while (set_size > 0) { - client.sadd("bigset", "member " + set_size); - set_size -= 1; - } - - // multi chain with an individual callback - client.multi() - .scard("bigset") - .smembers("bigset") - .keys("*", function (err, replies) { - // NOTE: code in this callback is NOT atomic - // this only happens after the the .exec call finishes. - client.mget(replies, redis.print); - }) - .dbsize() - .exec(function (err, replies) { - console.log("MULTI got " + replies.length + " replies"); - replies.forEach(function (reply, index) { - console.log("Reply " + index + ": " + reply.toString()); - }); - }); -``` - -`client.multi()` is a constructor that returns a `Multi` object. `Multi` objects share all of the -same command methods as `client` objects do. Commands are queued up inside the `Multi` object -until `Multi.exec()` is invoked. - -You can either chain together `MULTI` commands as in the above example, or you can queue individual -commands while still sending regular client command as in this example: - -```js - var redis = require("redis"), - client = redis.createClient(), multi; - - // start a separate multi command queue - multi = client.multi(); - multi.incr("incr thing", redis.print); - multi.incr("incr other thing", redis.print); - - // runs immediately - client.mset("incr thing", 100, "incr other thing", 1, redis.print); - - // drains multi queue and runs atomically - multi.exec(function (err, replies) { - console.log(replies); // 101, 2 - }); - - // you can re-run the same transaction if you like - multi.exec(function (err, replies) { - console.log(replies); // 102, 3 - client.quit(); - }); -``` - -In addition to adding commands to the `MULTI` queue individually, you can also pass an array -of commands and arguments to the constructor: - -```js - var redis = require("redis"), - client = redis.createClient(), multi; - - client.multi([ - ["mget", "multifoo", "multibar", redis.print], - ["incr", "multifoo"], - ["incr", "multibar"] - ]).exec(function (err, replies) { - console.log(replies); - }); -``` - - -## Monitor mode - -Redis supports the `MONITOR` command, which lets you see all commands received by the Redis server -across all client connections, including from other client libraries and other computers. - -After you send the `MONITOR` command, no other commands are valid on that connection. `node_redis` -will emit a `monitor` event for every new monitor message that comes across. The callback for the -`monitor` event takes a timestamp from the Redis server and an array of command arguments. - -Here is a simple example: - -```js - var client = require("redis").createClient(), - util = require("util"); - - client.monitor(function (err, res) { - console.log("Entering monitoring mode."); - }); - - client.on("monitor", function (time, args) { - console.log(time + ": " + util.inspect(args)); - }); -``` - -# Extras - -Some other things you might like to know about. - -## client.server_info - -After the ready probe completes, the results from the INFO command are saved in the `client.server_info` -object. - -The `versions` key contains an array of the elements of the version string for easy comparison. - - > client.server_info.redis_version - '2.3.0' - > client.server_info.versions - [ 2, 3, 0 ] - -## redis.print() - -A handy callback function for displaying return values when testing. Example: - -```js - var redis = require("redis"), - client = redis.createClient(); - - client.on("connect", function () { - client.set("foo_rand000000000000", "some fantastic value", redis.print); - client.get("foo_rand000000000000", redis.print); - }); -``` - -This will print: - - Reply: OK - Reply: some fantastic value - -Note that this program will not exit cleanly because the client is still connected. - -## redis.debug_mode - -Boolean to enable debug mode and protocol tracing. - -```js - var redis = require("redis"), - client = redis.createClient(); - - redis.debug_mode = true; - - client.on("connect", function () { - client.set("foo_rand000000000000", "some fantastic value"); - }); -``` - -This will display: - - mjr:~/work/node_redis (master)$ node ~/example.js - send command: *3 - $3 - SET - $20 - foo_rand000000000000 - $20 - some fantastic value - - on_data: +OK - -`send command` is data sent into Redis and `on_data` is data received from Redis. - -## client.send_command(command_name, args, callback) - -Used internally to send commands to Redis. For convenience, nearly all commands that are published on the Redis -Wiki have been added to the `client` object. However, if I missed any, or if new commands are introduced before -this library is updated, you can use `send_command()` to send arbitrary commands to Redis. - -All commands are sent as multi-bulk commands. `args` can either be an Array of arguments, or omitted. - -## client.connected - -Boolean tracking the state of the connection to the Redis server. - -## client.command_queue.length - -The number of commands that have been sent to the Redis server but not yet replied to. You can use this to -enforce some kind of maximum queue depth for commands while connected. - -Don't mess with `client.command_queue` though unless you really know what you are doing. - -## client.offline_queue.length - -The number of commands that have been queued up for a future connection. You can use this to enforce -some kind of maximum queue depth for pre-connection commands. - -## client.retry_delay - -Current delay in milliseconds before a connection retry will be attempted. This starts at `250`. - -## client.retry_backoff - -Multiplier for future retry timeouts. This should be larger than 1 to add more time between retries. -Defaults to 1.7. The default initial connection retry is 250, so the second retry will be 425, followed by 723.5, etc. - -### Commands with Optional and Keyword arguments - -This applies to anything that uses an optional `[WITHSCORES]` or `[LIMIT offset count]` in the [redis.io/commands](http://redis.io/commands) documentation. - -Example: -```js -var args = [ 'myzset', 1, 'one', 2, 'two', 3, 'three', 99, 'ninety-nine' ]; -client.zadd(args, function (err, response) { - if (err) throw err; - console.log('added '+response+' items.'); - - // -Infinity and +Infinity also work - var args1 = [ 'myzset', '+inf', '-inf' ]; - client.zrevrangebyscore(args1, function (err, response) { - if (err) throw err; - console.log('example1', response); - // write your code here - }); - - var max = 3, min = 1, offset = 1, count = 2; - var args2 = [ 'myzset', max, min, 'WITHSCORES', 'LIMIT', offset, count ]; - client.zrevrangebyscore(args2, function (err, response) { - if (err) throw err; - console.log('example2', response); - // write your code here - }); -}); -``` - -## TODO - -Better tests for auth, disconnect/reconnect, and all combinations thereof. - -Stream large set/get values into and out of Redis. Otherwise the entire value must be in node's memory. - -Performance can be better for very large values. - -I think there are more performance improvements left in there for smaller values, especially for large lists of small values. - -## How to Contribute -- open a pull request and then wait for feedback (if - [DTrejo](http://github.com/dtrejo) does not get back to you within 2 days, - comment again with indignation!) - -## Contributors -Some people have have added features and fixed bugs in `node_redis` other than me. - -Ordered by date of first contribution. -[Auto-generated](http://github.com/dtrejo/node-authors) on Wed Jul 25 2012 19:14:59 GMT-0700 (PDT). - -- [Matt Ranney aka `mranney`](https://github.com/mranney) -- [Tim-Smart aka `tim-smart`](https://github.com/tim-smart) -- [Tj Holowaychuk aka `visionmedia`](https://github.com/visionmedia) -- [rick aka `technoweenie`](https://github.com/technoweenie) -- [Orion Henry aka `orionz`](https://github.com/orionz) -- [Aivo Paas aka `aivopaas`](https://github.com/aivopaas) -- [Hank Sims aka `hanksims`](https://github.com/hanksims) -- [Paul Carey aka `paulcarey`](https://github.com/paulcarey) -- [Pieter Noordhuis aka `pietern`](https://github.com/pietern) -- [nithesh aka `nithesh`](https://github.com/nithesh) -- [Andy Ray aka `andy2ray`](https://github.com/andy2ray) -- [unknown aka `unknowdna`](https://github.com/unknowdna) -- [Dave Hoover aka `redsquirrel`](https://github.com/redsquirrel) -- [Vladimir Dronnikov aka `dvv`](https://github.com/dvv) -- [Umair Siddique aka `umairsiddique`](https://github.com/umairsiddique) -- [Louis-Philippe Perron aka `lp`](https://github.com/lp) -- [Mark Dawson aka `markdaws`](https://github.com/markdaws) -- [Ian Babrou aka `bobrik`](https://github.com/bobrik) -- [Felix Geisendörfer aka `felixge`](https://github.com/felixge) -- [Jean-Hugues Pinson aka `undefined`](https://github.com/undefined) -- [Maksim Lin aka `maks`](https://github.com/maks) -- [Owen Smith aka `orls`](https://github.com/orls) -- [Zachary Scott aka `zzak`](https://github.com/zzak) -- [TEHEK Firefox aka `TEHEK`](https://github.com/TEHEK) -- [Isaac Z. Schlueter aka `isaacs`](https://github.com/isaacs) -- [David Trejo aka `DTrejo`](https://github.com/DTrejo) -- [Brian Noguchi aka `bnoguchi`](https://github.com/bnoguchi) -- [Philip Tellis aka `bluesmoon`](https://github.com/bluesmoon) -- [Marcus Westin aka `marcuswestin2`](https://github.com/marcuswestin2) -- [Jed Schmidt aka `jed`](https://github.com/jed) -- [Dave Peticolas aka `jdavisp3`](https://github.com/jdavisp3) -- [Trae Robrock aka `trobrock`](https://github.com/trobrock) -- [Shankar Karuppiah aka `shankar0306`](https://github.com/shankar0306) -- [Ignacio Burgueño aka `ignacio`](https://github.com/ignacio) - -Thanks. - -## LICENSE - "MIT License" - -Copyright (c) 2010 Matthew Ranney, http://ranney.com/ - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -![spacer](http://ranney.com/1px.gif) diff --git a/realtime/node_modules/redis/benches/buffer_bench.js b/realtime/node_modules/redis/benches/buffer_bench.js deleted file mode 100644 index a504fbc0..00000000 --- a/realtime/node_modules/redis/benches/buffer_bench.js +++ /dev/null @@ -1,89 +0,0 @@ -var source = new Buffer(100), - dest = new Buffer(100), i, j, k, tmp, count = 1000000, bytes = 100; - -for (i = 99 ; i >= 0 ; i--) { - source[i] = 120; -} - -var str = "This is a nice String.", - buf = new Buffer("This is a lovely Buffer."); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (Buffer.isBuffer(str)) {} -} -var end = new Date(); -console.log("Buffer.isBuffer(str) " + (end - start) + " ms"); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (Buffer.isBuffer(buf)) {} -} -var end = new Date(); -console.log("Buffer.isBuffer(buf) " + (end - start) + " ms"); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (str instanceof Buffer) {} -} -var end = new Date(); -console.log("str instanceof Buffer " + (end - start) + " ms"); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (buf instanceof Buffer) {} -} -var end = new Date(); -console.log("buf instanceof Buffer " + (end - start) + " ms"); - -for (i = bytes ; i > 0 ; i --) { - var start = new Date(); - for (j = count ; j > 0; j--) { - tmp = source.toString("ascii", 0, bytes); - } - var end = new Date(); - console.log("toString() " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i --) { - var start = new Date(); - for (j = count ; j > 0; j--) { - tmp = ""; - for (k = 0; k <= i ; k++) { - tmp += String.fromCharCode(source[k]); - } - } - var end = new Date(); - console.log("manual string " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i--) { - var start = new Date(); - for (j = count ; j > 0 ; j--) { - for (k = i ; k > 0 ; k--) { - dest[k] = source[k]; - } - } - var end = new Date(); - console.log("Manual copy " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i--) { - var start = new Date(); - for (j = count ; j > 0 ; j--) { - for (k = i ; k > 0 ; k--) { - dest[k] = 120; - } - } - var end = new Date(); - console.log("Direct assignment " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i--) { - var start = new Date(); - for (j = count ; j > 0 ; j--) { - source.copy(dest, 0, 0, i); - } - var end = new Date(); - console.log("Buffer.copy() " + i + " bytes " + (end - start) + " ms"); -} diff --git a/realtime/node_modules/redis/benches/hiredis_parser.js b/realtime/node_modules/redis/benches/hiredis_parser.js deleted file mode 100644 index f1515b11..00000000 --- a/realtime/node_modules/redis/benches/hiredis_parser.js +++ /dev/null @@ -1,38 +0,0 @@ -var Parser = require('../lib/parser/hiredis').Parser; -var assert = require('assert'); - -/* -This test makes sure that exceptions thrown inside of "reply" event handlers -are not trapped and mistakenly emitted as parse errors. -*/ -(function testExecuteDoesNotCatchReplyCallbackExceptions() { - var parser = new Parser(); - var replies = [{}]; - - parser.reader = { - feed: function() {}, - get: function() { - return replies.shift(); - } - }; - - var emittedError = false; - var caughtException = false; - - parser - .on('error', function() { - emittedError = true; - }) - .on('reply', function() { - throw new Error('bad'); - }); - - try { - parser.execute(); - } catch (err) { - caughtException = true; - } - - assert.equal(caughtException, true); - assert.equal(emittedError, false); -})(); diff --git a/realtime/node_modules/redis/benches/re_sub_test.js b/realtime/node_modules/redis/benches/re_sub_test.js deleted file mode 100644 index 64b8f312..00000000 --- a/realtime/node_modules/redis/benches/re_sub_test.js +++ /dev/null @@ -1,14 +0,0 @@ -var client = require('../index').createClient() - , client2 = require('../index').createClient() - , assert = require('assert'); - -client.once('subscribe', function (channel, count) { - client.unsubscribe('x'); - client.subscribe('x', function () { - client.quit(); - client2.quit(); - }); - client2.publish('x', 'hi'); -}); - -client.subscribe('x'); diff --git a/realtime/node_modules/redis/benches/reconnect_test.js b/realtime/node_modules/redis/benches/reconnect_test.js deleted file mode 100644 index 7abdd516..00000000 --- a/realtime/node_modules/redis/benches/reconnect_test.js +++ /dev/null @@ -1,29 +0,0 @@ -var redis = require("../index").createClient(null, null, { -// max_attempts: 4 -}); - -redis.on("error", function (err) { - console.log("Redis says: " + err); -}); - -redis.on("ready", function () { - console.log("Redis ready."); -}); - -redis.on("reconnecting", function (arg) { - console.log("Redis reconnecting: " + JSON.stringify(arg)); -}); -redis.on("connect", function () { - console.log("Redis connected."); -}); - -setInterval(function () { - var now = Date.now(); - redis.set("now", now, function (err, res) { - if (err) { - console.log(now + " Redis reply error: " + err); - } else { - console.log(now + " Redis reply: " + res); - } - }); -}, 100); diff --git a/realtime/node_modules/redis/benches/stress/codec.js b/realtime/node_modules/redis/benches/stress/codec.js deleted file mode 100644 index 7d764f60..00000000 --- a/realtime/node_modules/redis/benches/stress/codec.js +++ /dev/null @@ -1,16 +0,0 @@ -var json = { - encode: JSON.stringify, - decode: JSON.parse -}; - -var MsgPack = require('node-msgpack'); -msgpack = { - encode: MsgPack.pack, - decode: function(str) { return MsgPack.unpack(new Buffer(str)); } -}; - -bison = require('bison'); - -module.exports = json; -//module.exports = msgpack; -//module.exports = bison; diff --git a/realtime/node_modules/redis/benches/stress/pubsub/pub.js b/realtime/node_modules/redis/benches/stress/pubsub/pub.js deleted file mode 100644 index 0acde7a6..00000000 --- a/realtime/node_modules/redis/benches/stress/pubsub/pub.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -var profiler = require('v8-profiler'); -var codec = require('../codec'); - -var sent = 0; - -var pub = require('redis').createClient(null, null, { - //command_queue_high_water: 5, - //command_queue_low_water: 1 -}) -.on('ready', function() { - this.emit('drain'); -}) -.on('drain', function() { - process.nextTick(exec); -}); - -var payload = '1'; for (var i = 0; i < 12; ++i) payload += payload; -console.log('Message payload length', payload.length); - -function exec() { - pub.publish('timeline', codec.encode({ foo: payload })); - ++sent; - if (!pub.should_buffer) { - process.nextTick(exec); - } -} - -profiler.takeSnapshot('s_0'); - -exec(); - -setInterval(function() { - profiler.takeSnapshot('s_' + sent); - console.error('sent', sent, 'free', freemem(), 'cmdqlen', pub.command_queue.length, 'offqlen', pub.offline_queue.length); -}, 2000); diff --git a/realtime/node_modules/redis/benches/stress/pubsub/run b/realtime/node_modules/redis/benches/stress/pubsub/run deleted file mode 100644 index bd9ac392..00000000 --- a/realtime/node_modules/redis/benches/stress/pubsub/run +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node --debug pub.js diff --git a/realtime/node_modules/redis/benches/stress/pubsub/server.js b/realtime/node_modules/redis/benches/stress/pubsub/server.js deleted file mode 100644 index 035e6b74..00000000 --- a/realtime/node_modules/redis/benches/stress/pubsub/server.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -var codec = require('../codec'); - -var id = Math.random(); -var recv = 0; - -var sub = require('redis').createClient() - .on('ready', function() { - this.subscribe('timeline'); - }) - .on('message', function(channel, message) { - var self = this; - if (message) { - message = codec.decode(message); - ++recv; - } - }); - -setInterval(function() { - console.error('id', id, 'received', recv, 'free', freemem()); -}, 2000); diff --git a/realtime/node_modules/redis/benches/stress/rpushblpop/pub.js b/realtime/node_modules/redis/benches/stress/rpushblpop/pub.js deleted file mode 100644 index 9caf1d0b..00000000 --- a/realtime/node_modules/redis/benches/stress/rpushblpop/pub.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -//var profiler = require('v8-profiler'); -var codec = require('../codec'); - -var sent = 0; - -var pub = require('redis').createClient(null, null, { - //command_queue_high_water: 5, - //command_queue_low_water: 1 -}) -.on('ready', function() { - this.del('timeline'); - this.emit('drain'); -}) -.on('drain', function() { - process.nextTick(exec); -}); - -var payload = '1'; for (var i = 0; i < 12; ++i) payload += payload; -console.log('Message payload length', payload.length); - -function exec() { - pub.rpush('timeline', codec.encode({ foo: payload })); - ++sent; - if (!pub.should_buffer) { - process.nextTick(exec); - } -} - -//profiler.takeSnapshot('s_0'); - -exec(); - -setInterval(function() { - //var ss = profiler.takeSnapshot('s_' + sent); - //console.error(ss.stringify()); - pub.llen('timeline', function(err, result) { - console.error('sent', sent, 'free', freemem(), - 'cmdqlen', pub.command_queue.length, 'offqlen', pub.offline_queue.length, - 'llen', result - ); - }); -}, 2000); - -/*setTimeout(function() { - process.exit(); -}, 30000);*/ diff --git a/realtime/node_modules/redis/benches/stress/rpushblpop/run b/realtime/node_modules/redis/benches/stress/rpushblpop/run deleted file mode 100644 index 8045ae80..00000000 --- a/realtime/node_modules/redis/benches/stress/rpushblpop/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -node server.js & -#node server.js & -#node server.js & -#node server.js & -node --debug pub.js diff --git a/realtime/node_modules/redis/benches/stress/rpushblpop/server.js b/realtime/node_modules/redis/benches/stress/rpushblpop/server.js deleted file mode 100644 index 9cbcdd9e..00000000 --- a/realtime/node_modules/redis/benches/stress/rpushblpop/server.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -var codec = require('../codec'); - -var id = Math.random(); -var recv = 0; - -var cmd = require('redis').createClient(); -var sub = require('redis').createClient() - .on('ready', function() { - this.emit('timeline'); - }) - .on('timeline', function() { - var self = this; - this.blpop('timeline', 0, function(err, result) { - var message = result[1]; - if (message) { - message = codec.decode(message); - ++recv; - } - self.emit('timeline'); - }); - }); - -setInterval(function() { - cmd.llen('timeline', function(err, result) { - console.error('id', id, 'received', recv, 'free', freemem(), 'llen', result); - }); -}, 2000); diff --git a/realtime/node_modules/redis/benches/stress/speed/00 b/realtime/node_modules/redis/benches/stress/speed/00 deleted file mode 100644 index 29d7bf7c..00000000 --- a/realtime/node_modules/redis/benches/stress/speed/00 +++ /dev/null @@ -1,13 +0,0 @@ -# size JSON msgpack bison -26602 2151.0170848180414 -25542 ? 2842.589272665782 -24835 ? ? 7280.4538397469805 -6104 6985.234528557929 -5045 ? 7217.461392841478 -4341 ? ? 14261.406335354604 -4180 15864.633685636572 -4143 ? 12954.806235781925 -4141 ? ? 44650.70733912719 -75 114227.07313350472 -40 ? 30162.440062810834 -39 ? ? 119815.66013519121 diff --git a/realtime/node_modules/redis/benches/stress/speed/plot b/realtime/node_modules/redis/benches/stress/speed/plot deleted file mode 100644 index 2563797c..00000000 --- a/realtime/node_modules/redis/benches/stress/speed/plot +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -gnuplot >size-rate.jpg << _EOF_ - -set terminal png nocrop enhanced font verdana 12 size 640,480 -set logscale x -set logscale y -set grid -set xlabel 'Serialized object size, octets' -set ylabel 'decode(encode(obj)) rate, 1/sec' -plot '00' using 1:2 title 'json' smooth bezier, '00' using 1:3 title 'msgpack' smooth bezier, '00' using 1:4 title 'bison' smooth bezier - -_EOF_ diff --git a/realtime/node_modules/redis/benches/stress/speed/size-rate.png b/realtime/node_modules/redis/benches/stress/speed/size-rate.png deleted file mode 100644 index c9c2bee6..00000000 Binary files a/realtime/node_modules/redis/benches/stress/speed/size-rate.png and /dev/null differ diff --git a/realtime/node_modules/redis/benches/stress/speed/speed.js b/realtime/node_modules/redis/benches/stress/speed/speed.js deleted file mode 100644 index 8e43cbc0..00000000 --- a/realtime/node_modules/redis/benches/stress/speed/speed.js +++ /dev/null @@ -1,84 +0,0 @@ -var msgpack = require('node-msgpack'); -var bison = require('bison'); -var codec = { - JSON: { - encode: JSON.stringify, - decode: JSON.parse - }, - msgpack: { - encode: msgpack.pack, - decode: msgpack.unpack - }, - bison: bison -}; - -var obj, l; - -var s = '0'; -for (var i = 0; i < 12; ++i) s += s; - -obj = { - foo: s, - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [], - a: s, - ccc: s, - b: s + s + s -}; -for (i = 0; i < 100; ++i) obj.rand.push(Math.random()); -forObj(obj); - -obj = { - foo: s, - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [] -}; -for (i = 0; i < 100; ++i) obj.rand.push(Math.random()); -forObj(obj); - -obj = { - foo: s, - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [] -}; -forObj(obj); - -obj = { - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [] -}; -forObj(obj); - -function run(obj, codec) { - var t1 = Date.now(); - var n = 10000; - for (var i = 0; i < n; ++i) { - codec.decode(l = codec.encode(obj)); - } - var t2 = Date.now(); - //console.log('DONE', n*1000/(t2-t1), 'codecs/sec, length=', l.length); - return [n*1000/(t2-t1), l.length]; -} - -function series(obj, cname, n) { - var rate = 0; - var len = 0; - for (var i = 0; i < n; ++i) { - var r = run(obj, codec[cname]); - rate += r[0]; - len += r[1]; - } - rate /= n; - len /= n; - console.log(cname + ' ' + rate + ' ' + len); - return [rate, len]; -} - -function forObj(obj) { - var r = { - JSON: series(obj, 'JSON', 20), - msgpack: series(obj, 'msgpack', 20), - bison: series(obj, 'bison', 20) - }; - return r; -} diff --git a/realtime/node_modules/redis/benches/sub_quit_test.js b/realtime/node_modules/redis/benches/sub_quit_test.js deleted file mode 100644 index ad1f4132..00000000 --- a/realtime/node_modules/redis/benches/sub_quit_test.js +++ /dev/null @@ -1,18 +0,0 @@ -var client = require("redis").createClient(), - client2 = require("redis").createClient(); - -client.subscribe("something"); -client.on("subscribe", function (channel, count) { - console.log("Got sub: " + channel); - client.unsubscribe("something"); -}); - -client.on("unsubscribe", function (channel, count) { - console.log("Got unsub: " + channel + ", quitting"); - client.quit(); -}); - -// exercise unsub before sub -client2.unsubscribe("something"); -client2.subscribe("another thing"); -client2.quit(); diff --git a/realtime/node_modules/redis/changelog.md b/realtime/node_modules/redis/changelog.md deleted file mode 100644 index 4248288c..00000000 --- a/realtime/node_modules/redis/changelog.md +++ /dev/null @@ -1,219 +0,0 @@ -Changelog -========= - -## v0.7.2 - April 29, 2012 - -Many contributed fixes. Thank you, contributors. - -* [GH-190] - pub/sub mode fix (Brian Noguchi) -* [GH-165] - parser selection fix (TEHEK) -* numerous documentation and examples updates -* auth errors emit Errors instead of Strings (David Trejo) - -## v0.7.1 - November 15, 2011 - -Fix regression in reconnect logic. - -Very much need automated tests for reconnection and queue logic. - -## v0.7.0 - November 14, 2011 - -Many contributed fixes. Thanks everybody. - -* [GH-127] - properly re-initialize parser on reconnect -* [GH-136] - handle passing undefined as callback (Ian Babrou) -* [GH-139] - properly handle exceptions thrown in pub/sub event handlers (Felix Geisendörfer) -* [GH-141] - detect closing state on stream error (Felix Geisendörfer) -* [GH-142] - re-select database on reconnection (Jean-Hugues Pinson) -* [GH-146] - add sort example (Maksim Lin) - -Some more goodies: - -* Fix bugs with node 0.6 -* Performance improvements -* New version of `multi_bench.js` that tests more realistic scenarios -* [GH-140] - support optional callback for subscribe commands -* Properly flush and error out command queue when connection fails -* Initial work on reconnection thresholds - -## v0.6.7 - July 30, 2011 - -(accidentally skipped v0.6.6) - -Fix and test for [GH-123] - -Passing an Array as as the last argument should expand as users -expect. The old behavior was to coerce the arguments into Strings, -which did surprising things with Arrays. - -## v0.6.5 - July 6, 2011 - -Contributed changes: - -* Support SlowBuffers (Umair Siddique) -* Add Multi to exports (Louis-Philippe Perron) -* Fix for drain event calculation (Vladimir Dronnikov) - -Thanks! - -## v0.6.4 - June 30, 2011 - -Fix bug with optional callbacks for hmset. - -## v0.6.2 - June 30, 2011 - -Bugs fixed: - -* authentication retry while server is loading db (danmaz74) [GH-101] -* command arguments processing issue with arrays - -New features: - -* Auto update of new commands from redis.io (Dave Hoover) -* Performance improvements and backpressure controls. -* Commands now return the true/false value from the underlying socket write(s). -* Implement command_queue high water and low water for more better control of queueing. - -See `examples/backpressure_drain.js` for more information. - -## v0.6.1 - June 29, 2011 - -Add support and tests for Redis scripting through EXEC command. - -Bug fix for monitor mode. (forddg) - -Auto update of new commands from redis.io (Dave Hoover) - -## v0.6.0 - April 21, 2011 - -Lots of bugs fixed. - -* connection error did not properly trigger reconnection logic [GH-85] -* client.hmget(key, [val1, val2]) was not expanding properly [GH-66] -* client.quit() while in pub/sub mode would throw an error [GH-87] -* client.multi(['hmset', 'key', {foo: 'bar'}]) fails [GH-92] -* unsubscribe before subscribe would make things very confused [GH-88] -* Add BRPOPLPUSH [GH-79] - -## v0.5.11 - April 7, 2011 - -Added DISCARD - -I originally didn't think DISCARD would do anything here because of the clever MULTI interface, but somebody -pointed out to me that DISCARD can be used to flush the WATCH set. - -## v0.5.10 - April 6, 2011 - -Added HVALS - -## v0.5.9 - March 14, 2011 - -Fix bug with empty Array arguments - Andy Ray - -## v0.5.8 - March 14, 2011 - -Add `MONITOR` command and special monitor command reply parsing. - -## v0.5.7 - February 27, 2011 - -Add magical auth command. - -Authentication is now remembered by the client and will be automatically sent to the server -on every connection, including any reconnections. - -## v0.5.6 - February 22, 2011 - -Fix bug in ready check with `return_buffers` set to `true`. - -Thanks to Dean Mao and Austin Chau. - -## v0.5.5 - February 16, 2011 - -Add probe for server readiness. - -When a Redis server starts up, it might take a while to load the dataset into memory. -During this time, the server will accept connections, but will return errors for all non-INFO -commands. Now node_redis will send an INFO command whenever it connects to a server. -If the info command indicates that the server is not ready, the client will keep trying until -the server is ready. Once it is ready, the client will emit a "ready" event as well as the -"connect" event. The client will queue up all commands sent before the server is ready, just -like it did before. When the server is ready, all offline/non-ready commands will be replayed. -This should be backward compatible with previous versions. - -To disable this ready check behavior, set `options.no_ready_check` when creating the client. - -As a side effect of this change, the key/val params from the info command are available as -`client.server_options`. Further, the version string is decomposed into individual elements -in `client.server_options.versions`. - -## v0.5.4 - February 11, 2011 - -Fix excess memory consumption from Queue backing store. - -Thanks to Gustaf Sjöberg. - -## v0.5.3 - February 5, 2011 - -Fix multi/exec error reply callback logic. - -Thanks to Stella Laurenzo. - -## v0.5.2 - January 18, 2011 - -Fix bug where unhandled error replies confuse the parser. - -## v0.5.1 - January 18, 2011 - -Fix bug where subscribe commands would not handle redis-server startup error properly. - -## v0.5.0 - December 29, 2010 - -Some bug fixes: - -* An important bug fix in reconnection logic. Previously, reply callbacks would be invoked twice after - a reconnect. -* Changed error callback argument to be an actual Error object. - -New feature: - -* Add friendly syntax for HMSET using an object. - -## v0.4.1 - December 8, 2010 - -Remove warning about missing hiredis. You probably do want it though. - -## v0.4.0 - December 5, 2010 - -Support for multiple response parsers and hiredis C library from Pieter Noordhuis. -Return Strings instead of Buffers by default. -Empty nested mb reply bug fix. - -## v0.3.9 - November 30, 2010 - -Fix parser bug on failed EXECs. - -## v0.3.8 - November 10, 2010 - -Fix for null MULTI response when WATCH condition fails. - -## v0.3.7 - November 9, 2010 - -Add "drain" and "idle" events. - -## v0.3.6 - November 3, 2010 - -Add all known Redis commands from Redis master, even ones that are coming in 2.2 and beyond. - -Send a friendlier "error" event message on stream errors like connection refused / reset. - -## v0.3.5 - October 21, 2010 - -A few bug fixes. - -* Fixed bug with `nil` multi-bulk reply lengths that showed up with `BLPOP` timeouts. -* Only emit `end` once when connection goes away. -* Fixed bug in `test.js` where driver finished before all tests completed. - -## unversioned wasteland - -See the git history for what happened before. diff --git a/realtime/node_modules/redis/diff_multi_bench_output.js b/realtime/node_modules/redis/diff_multi_bench_output.js deleted file mode 100644 index 99fdf4df..00000000 --- a/realtime/node_modules/redis/diff_multi_bench_output.js +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env node - -var colors = require('colors'), - fs = require('fs'), - _ = require('underscore'), - metrics = require('metrics'), - - // `node diff_multi_bench_output.js before.txt after.txt` - before = process.argv[2], - after = process.argv[3]; - -if (!before || !after) { - console.log('Please supply two file arguments:'); - var n = __filename; - n = n.substring(n.lastIndexOf('/', n.length)); - console.log(' ./' + n + ' multiBenchBefore.txt multiBenchAfter.txt'); - console.log('To generate multiBenchBefore.txt, run'); - console.log(' node multi_bench.js > multiBenchBefore.txt'); - console.log('Thank you for benchmarking responsibly.'); - return; -} - -var before_lines = fs.readFileSync(before, 'utf8').split('\n'), - after_lines = fs.readFileSync(after, 'utf8').split('\n'); - -console.log('Comparing before,', before.green, '(', before_lines.length, - 'lines)', 'to after,', after.green, '(', after_lines.length, 'lines)'); - -var total_ops = new metrics.Histogram.createUniformHistogram(); - -before_lines.forEach(function(b, i) { - var a = after_lines[i]; - if (!a || !b || !b.trim() || !a.trim()) { - // console.log('#ignored#', '>'+a+'<', '>'+b+'<'); - return; - } - - b_words = b.split(' ').filter(is_whitespace); - a_words = a.split(' ').filter(is_whitespace); - - var ops = - [b_words, a_words] - .map(function(words) { - // console.log(words); - return parseInt10(words.slice(-2, -1)); - }).filter(function(num) { - var isNaN = !num && num !== 0; - return !isNaN; - }); - if (ops.length != 2) return - - var delta = ops[1] - ops[0]; - - total_ops.update(delta); - - delta = humanize_diff(delta); - console.log( - // name of test - command_name(a_words) == command_name(b_words) - ? command_name(a_words) + ':' - : '404:', - // results of test - ops.join(' -> '), 'ops/sec (∆', delta, ')'); -}); - -console.log('Mean difference in ops/sec:', humanize_diff(total_ops.mean())); - -function is_whitespace(s) { - return !!s.trim(); -} - -function parseInt10(s) { - return parseInt(s, 10); -} - -// green if greater than 0, red otherwise -function humanize_diff(num) { - if (num > 0) { - return ('+' + num).green; - } - return ('' + num).red; -} - -function command_name(words) { - var line = words.join(' '); - return line.substr(0, line.indexOf(',')); -} diff --git a/realtime/node_modules/redis/examples/auth.js b/realtime/node_modules/redis/examples/auth.js deleted file mode 100644 index 6c0a563c..00000000 --- a/realtime/node_modules/redis/examples/auth.js +++ /dev/null @@ -1,5 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -// This command is magical. Client stashes the password and will issue on every connect. -client.auth("somepass"); diff --git a/realtime/node_modules/redis/examples/backpressure_drain.js b/realtime/node_modules/redis/examples/backpressure_drain.js deleted file mode 100644 index 3488ef4d..00000000 --- a/realtime/node_modules/redis/examples/backpressure_drain.js +++ /dev/null @@ -1,33 +0,0 @@ -var redis = require("../index"), - client = redis.createClient(null, null, { - command_queue_high_water: 5, - command_queue_low_water: 1 - }), - remaining_ops = 100000, paused = false; - -function op() { - if (remaining_ops <= 0) { - console.error("Finished."); - process.exit(0); - } - - remaining_ops--; - if (client.hset("test hash", "val " + remaining_ops, remaining_ops) === false) { - console.log("Pausing at " + remaining_ops); - paused = true; - } else { - process.nextTick(op); - } -} - -client.on("drain", function () { - if (paused) { - console.log("Resuming at " + remaining_ops); - paused = false; - process.nextTick(op); - } else { - console.log("Got drain while not paused at " + remaining_ops); - } -}); - -op(); diff --git a/realtime/node_modules/redis/examples/eval.js b/realtime/node_modules/redis/examples/eval.js deleted file mode 100644 index c1fbf8a5..00000000 --- a/realtime/node_modules/redis/examples/eval.js +++ /dev/null @@ -1,9 +0,0 @@ -var redis = require("./index"), - client = redis.createClient(); - -redis.debug_mode = true; - -client.eval("return 100.5", 0, function (err, res) { - console.dir(err); - console.dir(res); -}); diff --git a/realtime/node_modules/redis/examples/extend.js b/realtime/node_modules/redis/examples/extend.js deleted file mode 100644 index 488b8c2d..00000000 --- a/realtime/node_modules/redis/examples/extend.js +++ /dev/null @@ -1,24 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -// Extend the RedisClient prototype to add a custom method -// This one converts the results from "INFO" into a JavaScript Object - -redis.RedisClient.prototype.parse_info = function (callback) { - this.info(function (err, res) { - var lines = res.toString().split("\r\n").sort(); - var obj = {}; - lines.forEach(function (line) { - var parts = line.split(':'); - if (parts[1]) { - obj[parts[0]] = parts[1]; - } - }); - callback(obj) - }); -}; - -client.parse_info(function (info) { - console.dir(info); - client.quit(); -}); diff --git a/realtime/node_modules/redis/examples/file.js b/realtime/node_modules/redis/examples/file.js deleted file mode 100644 index 4d2b5d1c..00000000 --- a/realtime/node_modules/redis/examples/file.js +++ /dev/null @@ -1,32 +0,0 @@ -// Read a file from disk, store it in Redis, then read it back from Redis. - -var redis = require("redis"), - client = redis.createClient(), - fs = require("fs"), - filename = "kids_in_cart.jpg"; - -// Get the file I use for testing like this: -// curl http://ranney.com/kids_in_cart.jpg -o kids_in_cart.jpg -// or just use your own file. - -// Read a file from fs, store it in Redis, get it back from Redis, write it back to fs. -fs.readFile(filename, function (err, data) { - if (err) throw err - console.log("Read " + data.length + " bytes from filesystem."); - - client.set(filename, data, redis.print); // set entire file - client.get(filename, function (err, reply) { // get entire file - if (err) { - console.log("Get error: " + err); - } else { - fs.writeFile("duplicate_" + filename, reply, function (err) { - if (err) { - console.log("Error on write: " + err) - } else { - console.log("File written."); - } - client.end(); - }); - } - }); -}); diff --git a/realtime/node_modules/redis/examples/mget.js b/realtime/node_modules/redis/examples/mget.js deleted file mode 100644 index 936740d3..00000000 --- a/realtime/node_modules/redis/examples/mget.js +++ /dev/null @@ -1,5 +0,0 @@ -var client = require("redis").createClient(); - -client.mget(["sessions started", "sessions started", "foo"], function (err, res) { - console.dir(res); -}); \ No newline at end of file diff --git a/realtime/node_modules/redis/examples/monitor.js b/realtime/node_modules/redis/examples/monitor.js deleted file mode 100644 index 2cb6a4e1..00000000 --- a/realtime/node_modules/redis/examples/monitor.js +++ /dev/null @@ -1,10 +0,0 @@ -var client = require("../index").createClient(), - util = require("util"); - -client.monitor(function (err, res) { - console.log("Entering monitoring mode."); -}); - -client.on("monitor", function (time, args) { - console.log(time + ": " + util.inspect(args)); -}); diff --git a/realtime/node_modules/redis/examples/multi.js b/realtime/node_modules/redis/examples/multi.js deleted file mode 100644 index 35c08e18..00000000 --- a/realtime/node_modules/redis/examples/multi.js +++ /dev/null @@ -1,46 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(), set_size = 20; - -client.sadd("bigset", "a member"); -client.sadd("bigset", "another member"); - -while (set_size > 0) { - client.sadd("bigset", "member " + set_size); - set_size -= 1; -} - -// multi chain with an individual callback -client.multi() - .scard("bigset") - .smembers("bigset") - .keys("*", function (err, replies) { - client.mget(replies, redis.print); - }) - .dbsize() - .exec(function (err, replies) { - console.log("MULTI got " + replies.length + " replies"); - replies.forEach(function (reply, index) { - console.log("Reply " + index + ": " + reply.toString()); - }); - }); - -client.mset("incr thing", 100, "incr other thing", 1, redis.print); - -// start a separate multi command queue -var multi = client.multi(); -multi.incr("incr thing", redis.print); -multi.incr("incr other thing", redis.print); - -// runs immediately -client.get("incr thing", redis.print); // 100 - -// drains multi queue and runs atomically -multi.exec(function (err, replies) { - console.log(replies); // 101, 2 -}); - -// you can re-run the same transaction if you like -multi.exec(function (err, replies) { - console.log(replies); // 102, 3 - client.quit(); -}); diff --git a/realtime/node_modules/redis/examples/multi2.js b/realtime/node_modules/redis/examples/multi2.js deleted file mode 100644 index 8be4d731..00000000 --- a/realtime/node_modules/redis/examples/multi2.js +++ /dev/null @@ -1,29 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(), multi; - -// start a separate command queue for multi -multi = client.multi(); -multi.incr("incr thing", redis.print); -multi.incr("incr other thing", redis.print); - -// runs immediately -client.mset("incr thing", 100, "incr other thing", 1, redis.print); - -// drains multi queue and runs atomically -multi.exec(function (err, replies) { - console.log(replies); // 101, 2 -}); - -// you can re-run the same transaction if you like -multi.exec(function (err, replies) { - console.log(replies); // 102, 3 - client.quit(); -}); - -client.multi([ - ["mget", "multifoo", "multibar", redis.print], - ["incr", "multifoo"], - ["incr", "multibar"] -]).exec(function (err, replies) { - console.log(replies.toString()); -}); diff --git a/realtime/node_modules/redis/examples/psubscribe.js b/realtime/node_modules/redis/examples/psubscribe.js deleted file mode 100644 index c57117b8..00000000 --- a/realtime/node_modules/redis/examples/psubscribe.js +++ /dev/null @@ -1,33 +0,0 @@ -var redis = require("redis"), - client1 = redis.createClient(), - client2 = redis.createClient(), - client3 = redis.createClient(), - client4 = redis.createClient(), - msg_count = 0; - -redis.debug_mode = false; - -client1.on("psubscribe", function (pattern, count) { - console.log("client1 psubscribed to " + pattern + ", " + count + " total subscriptions"); - client2.publish("channeltwo", "Me!"); - client3.publish("channelthree", "Me too!"); - client4.publish("channelfour", "And me too!"); -}); - -client1.on("punsubscribe", function (pattern, count) { - console.log("client1 punsubscribed from " + pattern + ", " + count + " total subscriptions"); - client4.end(); - client3.end(); - client2.end(); - client1.end(); -}); - -client1.on("pmessage", function (pattern, channel, message) { - console.log("("+ pattern +")" + " client1 received message on " + channel + ": " + message); - msg_count += 1; - if (msg_count === 3) { - client1.punsubscribe(); - } -}); - -client1.psubscribe("channel*"); diff --git a/realtime/node_modules/redis/examples/pub_sub.js b/realtime/node_modules/redis/examples/pub_sub.js deleted file mode 100644 index aa508d6c..00000000 --- a/realtime/node_modules/redis/examples/pub_sub.js +++ /dev/null @@ -1,41 +0,0 @@ -var redis = require("redis"), - client1 = redis.createClient(), msg_count = 0, - client2 = redis.createClient(); - -redis.debug_mode = false; - -// Most clients probably don't do much on "subscribe". This example uses it to coordinate things within one program. -client1.on("subscribe", function (channel, count) { - console.log("client1 subscribed to " + channel + ", " + count + " total subscriptions"); - if (count === 2) { - client2.publish("a nice channel", "I am sending a message."); - client2.publish("another one", "I am sending a second message."); - client2.publish("a nice channel", "I am sending my last message."); - } -}); - -client1.on("unsubscribe", function (channel, count) { - console.log("client1 unsubscribed from " + channel + ", " + count + " total subscriptions"); - if (count === 0) { - client2.end(); - client1.end(); - } -}); - -client1.on("message", function (channel, message) { - console.log("client1 channel " + channel + ": " + message); - msg_count += 1; - if (msg_count === 3) { - client1.unsubscribe(); - } -}); - -client1.on("ready", function () { - // if you need auth, do it here - client1.incr("did a thing"); - client1.subscribe("a nice channel", "another one"); -}); - -client2.on("ready", function () { - // if you need auth, do it here -}); diff --git a/realtime/node_modules/redis/examples/simple.js b/realtime/node_modules/redis/examples/simple.js deleted file mode 100644 index f1f2e320..00000000 --- a/realtime/node_modules/redis/examples/simple.js +++ /dev/null @@ -1,24 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -client.on("error", function (err) { - console.log("error event - " + client.host + ":" + client.port + " - " + err); -}); - -client.set("string key", "string val", redis.print); -client.hset("hash key", "hashtest 1", "some value", redis.print); -client.hset(["hash key", "hashtest 2", "some other value"], redis.print); -client.hkeys("hash key", function (err, replies) { - if (err) { - return console.error("error response - " + err); - } - - console.log(replies.length + " replies:"); - replies.forEach(function (reply, i) { - console.log(" " + i + ": " + reply); - }); -}); - -client.quit(function (err, res) { - console.log("Exiting from quit command."); -}); diff --git a/realtime/node_modules/redis/examples/sort.js b/realtime/node_modules/redis/examples/sort.js deleted file mode 100644 index e7c6249e..00000000 --- a/realtime/node_modules/redis/examples/sort.js +++ /dev/null @@ -1,17 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -client.sadd("mylist", 1); -client.sadd("mylist", 2); -client.sadd("mylist", 3); - -client.set("weight_1", 5); -client.set("weight_2", 500); -client.set("weight_3", 1); - -client.set("object_1", "foo"); -client.set("object_2", "bar"); -client.set("object_3", "qux"); - -client.sort("mylist", "by", "weight_*", "get", "object_*", redis.print); -// Prints Reply: qux,foo,bar \ No newline at end of file diff --git a/realtime/node_modules/redis/examples/subqueries.js b/realtime/node_modules/redis/examples/subqueries.js deleted file mode 100644 index 560db240..00000000 --- a/realtime/node_modules/redis/examples/subqueries.js +++ /dev/null @@ -1,15 +0,0 @@ -// Sending commands in response to other commands. -// This example runs "type" against every key in the database -// -var client = require("redis").createClient(); - -client.keys("*", function (err, keys) { - keys.forEach(function (key, pos) { - client.type(key, function (err, keytype) { - console.log(key + " is " + keytype); - if (pos === (keys.length - 1)) { - client.quit(); - } - }); - }); -}); diff --git a/realtime/node_modules/redis/examples/subquery.js b/realtime/node_modules/redis/examples/subquery.js deleted file mode 100644 index 861657e1..00000000 --- a/realtime/node_modules/redis/examples/subquery.js +++ /dev/null @@ -1,19 +0,0 @@ -var client = require("redis").createClient(); - -function print_results(obj) { - console.dir(obj); -} - -// build a map of all keys and their types -client.keys("*", function (err, all_keys) { - var key_types = {}; - - all_keys.forEach(function (key, pos) { // use second arg of forEach to get pos - client.type(key, function (err, type) { - key_types[key] = type; - if (pos === all_keys.length - 1) { // callbacks all run in order - print_results(key_types); - } - }); - }); -}); diff --git a/realtime/node_modules/redis/examples/unix_socket.js b/realtime/node_modules/redis/examples/unix_socket.js deleted file mode 100644 index 4a5e0bb0..00000000 --- a/realtime/node_modules/redis/examples/unix_socket.js +++ /dev/null @@ -1,29 +0,0 @@ -var redis = require("redis"), - client = redis.createClient("/tmp/redis.sock"), - profiler = require("v8-profiler"); - -client.on("connect", function () { - console.log("Got Unix socket connection.") -}); - -client.on("error", function (err) { - console.log(err.message); -}); - -client.set("space chars", "space value"); - -setInterval(function () { - client.get("space chars"); -}, 100); - -function done() { - client.info(function (err, reply) { - console.log(reply.toString()); - client.quit(); - }); -} - -setTimeout(function () { - console.log("Taking snapshot."); - var snap = profiler.takeSnapshot(); -}, 5000); diff --git a/realtime/node_modules/redis/examples/web_server.js b/realtime/node_modules/redis/examples/web_server.js deleted file mode 100644 index 9fd85923..00000000 --- a/realtime/node_modules/redis/examples/web_server.js +++ /dev/null @@ -1,31 +0,0 @@ -// A simple web server that generates dyanmic content based on responses from Redis - -var http = require("http"), server, - redis_client = require("redis").createClient(); - -server = http.createServer(function (request, response) { - response.writeHead(200, { - "Content-Type": "text/plain" - }); - - var redis_info, total_requests; - - redis_client.info(function (err, reply) { - redis_info = reply; // stash response in outer scope - }); - redis_client.incr("requests", function (err, reply) { - total_requests = reply; // stash response in outer scope - }); - redis_client.hincrby("ip", request.connection.remoteAddress, 1); - redis_client.hgetall("ip", function (err, reply) { - // This is the last reply, so all of the previous replies must have completed already - response.write("This page was generated after talking to redis.\n\n" + - "Redis info:\n" + redis_info + "\n" + - "Total requests: " + total_requests + "\n\n" + - "IP count: \n"); - Object.keys(reply).forEach(function (ip) { - response.write(" " + ip + ": " + reply[ip] + "\n"); - }); - response.end(); - }); -}).listen(80); diff --git a/realtime/node_modules/redis/generate_commands.js b/realtime/node_modules/redis/generate_commands.js deleted file mode 100644 index e6949d3a..00000000 --- a/realtime/node_modules/redis/generate_commands.js +++ /dev/null @@ -1,39 +0,0 @@ -var http = require("http"), - fs = require("fs"); - -function prettyCurrentTime() { - var date = new Date(); - return date.toLocaleString(); -} - -function write_file(commands, path) { - var file_contents, out_commands; - - console.log("Writing " + Object.keys(commands).length + " commands to " + path); - - file_contents = "// This file was generated by ./generate_commands.js on " + prettyCurrentTime() + "\n"; - - out_commands = Object.keys(commands).map(function (key) { - return key.toLowerCase(); - }); - - file_contents += "module.exports = " + JSON.stringify(out_commands, null, " ") + ";\n"; - - fs.writeFile(path, file_contents); -} - -http.get({host: "redis.io", path: "/commands.json"}, function (res) { - var body = ""; - - console.log("Response from redis.io/commands.json: " + res.statusCode); - - res.on('data', function (chunk) { - body += chunk; - }); - - res.on('end', function () { - write_file(JSON.parse(body), "lib/commands.js"); - }); -}).on('error', function (e) { - console.log("Error fetching command list from redis.io: " + e.message); -}); diff --git a/realtime/node_modules/redis/index.js b/realtime/node_modules/redis/index.js deleted file mode 100644 index 61cb4e91..00000000 --- a/realtime/node_modules/redis/index.js +++ /dev/null @@ -1,1113 +0,0 @@ -/*global Buffer require exports console setTimeout */ - -var net = require("net"), - util = require("./lib/util"), - Queue = require("./lib/queue"), - to_array = require("./lib/to_array"), - events = require("events"), - crypto = require("crypto"), - parsers = [], commands, - connection_id = 0, - default_port = 6379, - default_host = "127.0.0.1"; - -// can set this to true to enable for all connections -exports.debug_mode = false; - -// hiredis might not be installed -try { - require("./lib/parser/hiredis"); - parsers.push(require("./lib/parser/hiredis")); -} catch (err) { - if (exports.debug_mode) { - console.warn("hiredis parser not installed."); - } -} - -parsers.push(require("./lib/parser/javascript")); - -function RedisClient(stream, options) { - this.stream = stream; - this.options = options = options || {}; - - this.connection_id = ++connection_id; - this.connected = false; - this.ready = false; - this.connections = 0; - if (this.options.socket_nodelay === undefined) { - this.options.socket_nodelay = true; - } - this.should_buffer = false; - this.command_queue_high_water = this.options.command_queue_high_water || 1000; - this.command_queue_low_water = this.options.command_queue_low_water || 0; - this.max_attempts = null; - if (options.max_attempts && !isNaN(options.max_attempts) && options.max_attempts > 0) { - this.max_attempts = +options.max_attempts; - } - this.command_queue = new Queue(); // holds sent commands to de-pipeline them - this.offline_queue = new Queue(); // holds commands issued but not able to be sent - this.commands_sent = 0; - this.connect_timeout = false; - if (options.connect_timeout && !isNaN(options.connect_timeout) && options.connect_timeout > 0) { - this.connect_timeout = +options.connect_timeout; - } - - this.enable_offline_queue = true; - if (typeof this.options.enable_offline_queue === "boolean") { - this.enable_offline_queue = this.options.enable_offline_queue; - } - - this.initialize_retry_vars(); - this.pub_sub_mode = false; - this.subscription_set = {}; - this.monitoring = false; - this.closing = false; - this.server_info = {}; - this.auth_pass = null; - this.parser_module = null; - this.selected_db = null; // save the selected db here, used when reconnecting - - this.old_state = null; - - var self = this; - - this.stream.on("connect", function () { - self.on_connect(); - }); - - this.stream.on("data", function (buffer_from_socket) { - self.on_data(buffer_from_socket); - }); - - this.stream.on("error", function (msg) { - self.on_error(msg.message); - }); - - this.stream.on("close", function () { - self.connection_gone("close"); - }); - - this.stream.on("end", function () { - self.connection_gone("end"); - }); - - this.stream.on("drain", function () { - self.should_buffer = false; - self.emit("drain"); - }); - - events.EventEmitter.call(this); -} -util.inherits(RedisClient, events.EventEmitter); -exports.RedisClient = RedisClient; - -RedisClient.prototype.initialize_retry_vars = function () { - this.retry_timer = null; - this.retry_totaltime = 0; - this.retry_delay = 150; - this.retry_backoff = 1.7; - this.attempts = 1; -}; - -// flush offline_queue and command_queue, erroring any items with a callback first -RedisClient.prototype.flush_and_error = function (message) { - var command_obj; - while (this.offline_queue.length > 0) { - command_obj = this.offline_queue.shift(); - if (typeof command_obj.callback === "function") { - command_obj.callback(message); - } - } - this.offline_queue = new Queue(); - - while (this.command_queue.length > 0) { - command_obj = this.command_queue.shift(); - if (typeof command_obj.callback === "function") { - command_obj.callback(message); - } - } - this.command_queue = new Queue(); -}; - -RedisClient.prototype.on_error = function (msg) { - var message = "Redis connection to " + this.host + ":" + this.port + " failed - " + msg, - self = this, command_obj; - - if (this.closing) { - return; - } - - if (exports.debug_mode) { - console.warn(message); - } - - this.flush_and_error(message); - - this.connected = false; - this.ready = false; - - this.emit("error", new Error(message)); - // "error" events get turned into exceptions if they aren't listened for. If the user handled this error - // then we should try to reconnect. - this.connection_gone("error"); -}; - -RedisClient.prototype.do_auth = function () { - var self = this; - - if (exports.debug_mode) { - console.log("Sending auth to " + self.host + ":" + self.port + " id " + self.connection_id); - } - self.send_anyway = true; - self.send_command("auth", [this.auth_pass], function (err, res) { - if (err) { - if (err.toString().match("LOADING")) { - // if redis is still loading the db, it will not authenticate and everything else will fail - console.log("Redis still loading, trying to authenticate later"); - setTimeout(function () { - self.do_auth(); - }, 2000); // TODO - magic number alert - return; - } else { - return self.emit("error", new Error("Auth error: " + err.message)); - } - } - if (res.toString() !== "OK") { - return self.emit("error", new Error("Auth failed: " + res.toString())); - } - if (exports.debug_mode) { - console.log("Auth succeeded " + self.host + ":" + self.port + " id " + self.connection_id); - } - if (self.auth_callback) { - self.auth_callback(err, res); - self.auth_callback = null; - } - - // now we are really connected - self.emit("connect"); - if (self.options.no_ready_check) { - self.on_ready(); - } else { - self.ready_check(); - } - }); - self.send_anyway = false; -}; - -RedisClient.prototype.on_connect = function () { - if (exports.debug_mode) { - console.log("Stream connected " + this.host + ":" + this.port + " id " + this.connection_id); - } - var self = this; - - this.connected = true; - this.ready = false; - this.attempts = 0; - this.connections += 1; - this.command_queue = new Queue(); - this.emitted_end = false; - this.initialize_retry_vars(); - if (this.options.socket_nodelay) { - this.stream.setNoDelay(); - } - this.stream.setTimeout(0); - - this.init_parser(); - - if (this.auth_pass) { - this.do_auth(); - } else { - this.emit("connect"); - - if (this.options.no_ready_check) { - this.on_ready(); - } else { - this.ready_check(); - } - } -}; - -RedisClient.prototype.init_parser = function () { - var self = this; - - if (this.options.parser) { - if (! parsers.some(function (parser) { - if (parser.name === self.options.parser) { - self.parser_module = parser; - if (exports.debug_mode) { - console.log("Using parser module: " + self.parser_module.name); - } - return true; - } - })) { - throw new Error("Couldn't find named parser " + self.options.parser + " on this system"); - } - } else { - if (exports.debug_mode) { - console.log("Using default parser module: " + parsers[0].name); - } - this.parser_module = parsers[0]; - } - - this.parser_module.debug_mode = exports.debug_mode; - - // return_buffers sends back Buffers from parser to callback. detect_buffers sends back Buffers from parser, but - // converts to Strings if the input arguments are not Buffers. - this.reply_parser = new this.parser_module.Parser({ - return_buffers: self.options.return_buffers || self.options.detect_buffers || false - }); - - // "reply error" is an error sent back by Redis - this.reply_parser.on("reply error", function (reply) { - self.return_error(new Error(reply)); - }); - this.reply_parser.on("reply", function (reply) { - self.return_reply(reply); - }); - // "error" is bad. Somehow the parser got confused. It'll try to reset and continue. - this.reply_parser.on("error", function (err) { - self.emit("error", new Error("Redis reply parser error: " + err.stack)); - }); -}; - -RedisClient.prototype.on_ready = function () { - var self = this; - - this.ready = true; - - if (this.old_state !== null) { - this.monitoring = this.old_state.monitoring; - this.pub_sub_mode = this.old_state.pub_sub_mode; - this.selected_db = this.old_state.selected_db; - this.old_state = null; - } - - // magically restore any modal commands from a previous connection - if (this.selected_db !== null) { - this.send_command('select', [this.selected_db]); - } - if (this.pub_sub_mode === true) { - // only emit "ready" when all subscriptions were made again - var callback_count = 0; - var callback = function() { - callback_count--; - if (callback_count == 0) { - self.emit("ready"); - } - } - Object.keys(this.subscription_set).forEach(function (key) { - var parts = key.split(" "); - if (exports.debug_mode) { - console.warn("sending pub/sub on_ready " + parts[0] + ", " + parts[1]); - } - callback_count++; - self.send_command(parts[0] + "scribe", [parts[1]], callback); - }); - return; - } else if (this.monitoring) { - this.send_command("monitor"); - } else { - this.send_offline_queue(); - } - this.emit("ready"); -}; - -RedisClient.prototype.on_info_cmd = function (err, res) { - var self = this, obj = {}, lines, retry_time; - - if (err) { - return self.emit("error", new Error("Ready check failed: " + err.message)); - } - - lines = res.toString().split("\r\n"); - - lines.forEach(function (line) { - var parts = line.split(':'); - if (parts[1]) { - obj[parts[0]] = parts[1]; - } - }); - - obj.versions = []; - obj.redis_version.split('.').forEach(function (num) { - obj.versions.push(+num); - }); - - // expose info key/vals to users - this.server_info = obj; - - if (!obj.loading || (obj.loading && obj.loading === "0")) { - if (exports.debug_mode) { - console.log("Redis server ready."); - } - this.on_ready(); - } else { - retry_time = obj.loading_eta_seconds * 1000; - if (retry_time > 1000) { - retry_time = 1000; - } - if (exports.debug_mode) { - console.log("Redis server still loading, trying again in " + retry_time); - } - setTimeout(function () { - self.ready_check(); - }, retry_time); - } -}; - -RedisClient.prototype.ready_check = function () { - var self = this; - - if (exports.debug_mode) { - console.log("checking server ready state..."); - } - - this.send_anyway = true; // secret flag to send_command to send something even if not "ready" - this.info(function (err, res) { - self.on_info_cmd(err, res); - }); - this.send_anyway = false; -}; - -RedisClient.prototype.send_offline_queue = function () { - var command_obj, buffered_writes = 0; - - while (this.offline_queue.length > 0) { - command_obj = this.offline_queue.shift(); - if (exports.debug_mode) { - console.log("Sending offline command: " + command_obj.command); - } - buffered_writes += !this.send_command(command_obj.command, command_obj.args, command_obj.callback); - } - this.offline_queue = new Queue(); - // Even though items were shifted off, Queue backing store still uses memory until next add, so just get a new Queue - - if (!buffered_writes) { - this.should_buffer = false; - this.emit("drain"); - } -}; - -RedisClient.prototype.connection_gone = function (why) { - var self = this, message; - - // If a retry is already in progress, just let that happen - if (this.retry_timer) { - return; - } - - if (exports.debug_mode) { - console.warn("Redis connection is gone from " + why + " event."); - } - this.connected = false; - this.ready = false; - - if (this.old_state === null) { - var state = { - monitoring: this.monitoring, - pub_sub_mode: this.pub_sub_mode, - selected_db: this.selected_db - }; - this.old_state = state; - this.monitoring = false; - this.pub_sub_mode = false; - this.selected_db = null; - } - - // since we are collapsing end and close, users don't expect to be called twice - if (! this.emitted_end) { - this.emit("end"); - this.emitted_end = true; - } - - this.flush_and_error("Redis connection gone from " + why + " event."); - - // If this is a requested shutdown, then don't retry - if (this.closing) { - this.retry_timer = null; - if (exports.debug_mode) { - console.warn("connection ended from quit command, not retrying."); - } - return; - } - - this.retry_delay = Math.floor(this.retry_delay * this.retry_backoff); - - if (exports.debug_mode) { - console.log("Retry connection in " + this.current_retry_delay + " ms"); - } - - if (this.max_attempts && this.attempts >= this.max_attempts) { - this.retry_timer = null; - // TODO - some people need a "Redis is Broken mode" for future commands that errors immediately, and others - // want the program to exit. Right now, we just log, which doesn't really help in either case. - console.error("node_redis: Couldn't get Redis connection after " + this.max_attempts + " attempts."); - return; - } - - this.attempts += 1; - this.emit("reconnecting", { - delay: self.retry_delay, - attempt: self.attempts - }); - this.retry_timer = setTimeout(function () { - if (exports.debug_mode) { - console.log("Retrying connection..."); - } - - self.retry_totaltime += self.current_retry_delay; - - if (self.connect_timeout && self.retry_totaltime >= self.connect_timeout) { - self.retry_timer = null; - // TODO - engage Redis is Broken mode for future commands, or whatever - console.error("node_redis: Couldn't get Redis connection after " + self.retry_totaltime + "ms."); - return; - } - - self.stream.connect(self.port, self.host); - self.retry_timer = null; - }, this.retry_delay); -}; - -RedisClient.prototype.on_data = function (data) { - if (exports.debug_mode) { - console.log("net read " + this.host + ":" + this.port + " id " + this.connection_id + ": " + data.toString()); - } - - try { - this.reply_parser.execute(data); - } catch (err) { - // This is an unexpected parser problem, an exception that came from the parser code itself. - // Parser should emit "error" events if it notices things are out of whack. - // Callbacks that throw exceptions will land in return_reply(), below. - // TODO - it might be nice to have a different "error" event for different types of errors - this.emit("error", err); - } -}; - -RedisClient.prototype.return_error = function (err) { - var command_obj = this.command_queue.shift(), queue_len = this.command_queue.getLength(); - - if (this.pub_sub_mode === false && queue_len === 0) { - this.emit("idle"); - this.command_queue = new Queue(); - } - if (this.should_buffer && queue_len <= this.command_queue_low_water) { - this.emit("drain"); - this.should_buffer = false; - } - - if (command_obj && typeof command_obj.callback === "function") { - try { - command_obj.callback(err); - } catch (callback_err) { - // if a callback throws an exception, re-throw it on a new stack so the parser can keep going - process.nextTick(function () { - throw callback_err; - }); - } - } else { - console.log("node_redis: no callback to send error: " + err.message); - // this will probably not make it anywhere useful, but we might as well throw - process.nextTick(function () { - throw err; - }); - } -}; - -// if a callback throws an exception, re-throw it on a new stack so the parser can keep going. -// put this try/catch in its own function because V8 doesn't optimize this well yet. -function try_callback(callback, reply) { - try { - callback(null, reply); - } catch (err) { - process.nextTick(function () { - throw err; - }); - } -} - -// hgetall converts its replies to an Object. If the reply is empty, null is returned. -function reply_to_object(reply) { - var obj = {}, j, jl, key, val; - - if (reply.length === 0) { - return null; - } - - for (j = 0, jl = reply.length; j < jl; j += 2) { - key = reply[j].toString(); - val = reply[j + 1]; - obj[key] = val; - } - - return obj; -} - -function reply_to_strings(reply) { - var i; - - if (Buffer.isBuffer(reply)) { - return reply.toString(); - } - - if (Array.isArray(reply)) { - for (i = 0; i < reply.length; i++) { - reply[i] = reply[i].toString(); - } - return reply; - } - - return reply; -} - -RedisClient.prototype.return_reply = function (reply) { - var command_obj, obj, i, len, type, timestamp, argindex, args, queue_len; - - command_obj = this.command_queue.shift(), - queue_len = this.command_queue.getLength(); - - if (this.pub_sub_mode === false && queue_len === 0) { - this.emit("idle"); - this.command_queue = new Queue(); // explicitly reclaim storage from old Queue - } - if (this.should_buffer && queue_len <= this.command_queue_low_water) { - this.emit("drain"); - this.should_buffer = false; - } - - if (command_obj && !command_obj.sub_command) { - if (typeof command_obj.callback === "function") { - if (this.options.detect_buffers && command_obj.buffer_args === false) { - // If detect_buffers option was specified, then the reply from the parser will be Buffers. - // If this command did not use Buffer arguments, then convert the reply to Strings here. - reply = reply_to_strings(reply); - } - - // TODO - confusing and error-prone that hgetall is special cased in two places - if (reply && 'hgetall' === command_obj.command.toLowerCase()) { - reply = reply_to_object(reply); - } - - try_callback(command_obj.callback, reply); - } else if (exports.debug_mode) { - console.log("no callback for reply: " + (reply && reply.toString && reply.toString())); - } - } else if (this.pub_sub_mode || (command_obj && command_obj.sub_command)) { - if (Array.isArray(reply)) { - type = reply[0].toString(); - - if (type === "message") { - this.emit("message", reply[1].toString(), reply[2]); // channel, message - } else if (type === "pmessage") { - this.emit("pmessage", reply[1].toString(), reply[2].toString(), reply[3]); // pattern, channel, message - } else if (type === "subscribe" || type === "unsubscribe" || type === "psubscribe" || type === "punsubscribe") { - if (reply[2] === 0) { - this.pub_sub_mode = false; - if (this.debug_mode) { - console.log("All subscriptions removed, exiting pub/sub mode"); - } - } else { - this.pub_sub_mode = true; - } - // subscribe commands take an optional callback and also emit an event, but only the first response is included in the callback - // TODO - document this or fix it so it works in a more obvious way - if (command_obj && typeof command_obj.callback === "function") { - try_callback(command_obj.callback, reply[1].toString()); - } - this.emit(type, reply[1].toString(), reply[2]); // channel, count - } else { - throw new Error("subscriptions are active but got unknown reply type " + type); - } - } else if (! this.closing) { - throw new Error("subscriptions are active but got an invalid reply: " + reply); - } - } else if (this.monitoring) { - len = reply.indexOf(" "); - timestamp = reply.slice(0, len); - argindex = reply.indexOf('"'); - args = reply.slice(argindex + 1, -1).split('" "').map(function (elem) { - return elem.replace(/\\"/g, '"'); - }); - this.emit("monitor", timestamp, args); - } else { - throw new Error("node_redis command queue state error. If you can reproduce this, please report it."); - } -}; - -// This Command constructor is ever so slightly faster than using an object literal, but more importantly, using -// a named constructor helps it show up meaningfully in the V8 CPU profiler and in heap snapshots. -function Command(command, args, sub_command, buffer_args, callback) { - this.command = command; - this.args = args; - this.sub_command = sub_command; - this.buffer_args = buffer_args; - this.callback = callback; -} - -RedisClient.prototype.send_command = function (command, args, callback) { - var arg, this_args, command_obj, i, il, elem_count, buffer_args, stream = this.stream, command_str = "", buffered_writes = 0, last_arg_type; - - if (typeof command !== "string") { - throw new Error("First argument to send_command must be the command name string, not " + typeof command); - } - - if (Array.isArray(args)) { - if (typeof callback === "function") { - // probably the fastest way: - // client.command([arg1, arg2], cb); (straight passthrough) - // send_command(command, [arg1, arg2], cb); - } else if (! callback) { - // most people find this variable argument length form more convenient, but it uses arguments, which is slower - // client.command(arg1, arg2, cb); (wraps up arguments into an array) - // send_command(command, [arg1, arg2, cb]); - // client.command(arg1, arg2); (callback is optional) - // send_command(command, [arg1, arg2]); - // client.command(arg1, arg2, undefined); (callback is undefined) - // send_command(command, [arg1, arg2, undefined]); - last_arg_type = typeof args[args.length - 1]; - if (last_arg_type === "function" || last_arg_type === "undefined") { - callback = args.pop(); - } - } else { - throw new Error("send_command: last argument must be a callback or undefined"); - } - } else { - throw new Error("send_command: second argument must be an array"); - } - - // if the last argument is an array and command is sadd, expand it out: - // client.sadd(arg1, [arg2, arg3, arg4], cb); - // converts to: - // client.sadd(arg1, arg2, arg3, arg4, cb); - if ((command === 'sadd' || command === 'SADD') && args.length > 0 && Array.isArray(args[args.length - 1])) { - args = args.slice(0, -1).concat(args[args.length - 1]); - } - - buffer_args = false; - for (i = 0, il = args.length, arg; i < il; i += 1) { - if (Buffer.isBuffer(args[i])) { - buffer_args = true; - } - } - - command_obj = new Command(command, args, false, buffer_args, callback); - - if ((!this.ready && !this.send_anyway) || !stream.writable) { - if (exports.debug_mode) { - if (!stream.writable) { - console.log("send command: stream is not writeable."); - } - } - - if (this.enable_offline_queue) { - if (exports.debug_mode) { - console.log("Queueing " + command + " for next server connection."); - } - this.offline_queue.push(command_obj); - this.should_buffer = true; - } else { - var not_writeable_error = new Error('send_command: stream not writeable. enable_offline_queue is false'); - if (command_obj.callback) { - command_obj.callback(not_writeable_error); - } else { - throw not_writeable_error; - } - } - - return false; - } - - if (command === "subscribe" || command === "psubscribe" || command === "unsubscribe" || command === "punsubscribe") { - this.pub_sub_command(command_obj); - } else if (command === "monitor") { - this.monitoring = true; - } else if (command === "quit") { - this.closing = true; - } else if (this.pub_sub_mode === true) { - throw new Error("Connection in pub/sub mode, only pub/sub commands may be used"); - } - this.command_queue.push(command_obj); - this.commands_sent += 1; - - elem_count = args.length + 1; - - // Always use "Multi bulk commands", but if passed any Buffer args, then do multiple writes, one for each arg. - // This means that using Buffers in commands is going to be slower, so use Strings if you don't already have a Buffer. - - command_str = "*" + elem_count + "\r\n$" + command.length + "\r\n" + command + "\r\n"; - - if (! buffer_args) { // Build up a string and send entire command in one write - for (i = 0, il = args.length, arg; i < il; i += 1) { - arg = args[i]; - if (typeof arg !== "string") { - arg = String(arg); - } - command_str += "$" + Buffer.byteLength(arg) + "\r\n" + arg + "\r\n"; - } - if (exports.debug_mode) { - console.log("send " + this.host + ":" + this.port + " id " + this.connection_id + ": " + command_str); - } - buffered_writes += !stream.write(command_str); - } else { - if (exports.debug_mode) { - console.log("send command (" + command_str + ") has Buffer arguments"); - } - buffered_writes += !stream.write(command_str); - - for (i = 0, il = args.length, arg; i < il; i += 1) { - arg = args[i]; - if (!(Buffer.isBuffer(arg) || arg instanceof String)) { - arg = String(arg); - } - - if (Buffer.isBuffer(arg)) { - if (arg.length === 0) { - if (exports.debug_mode) { - console.log("send_command: using empty string for 0 length buffer"); - } - buffered_writes += !stream.write("$0\r\n\r\n"); - } else { - buffered_writes += !stream.write("$" + arg.length + "\r\n"); - buffered_writes += !stream.write(arg); - buffered_writes += !stream.write("\r\n"); - if (exports.debug_mode) { - console.log("send_command: buffer send " + arg.length + " bytes"); - } - } - } else { - if (exports.debug_mode) { - console.log("send_command: string send " + Buffer.byteLength(arg) + " bytes: " + arg); - } - buffered_writes += !stream.write("$" + Buffer.byteLength(arg) + "\r\n" + arg + "\r\n"); - } - } - } - if (exports.debug_mode) { - console.log("send_command buffered_writes: " + buffered_writes, " should_buffer: " + this.should_buffer); - } - if (buffered_writes || this.command_queue.getLength() >= this.command_queue_high_water) { - this.should_buffer = true; - } - return !this.should_buffer; -}; - -RedisClient.prototype.pub_sub_command = function (command_obj) { - var i, key, command, args; - - if (this.pub_sub_mode === false && exports.debug_mode) { - console.log("Entering pub/sub mode from " + command_obj.command); - } - this.pub_sub_mode = true; - command_obj.sub_command = true; - - command = command_obj.command; - args = command_obj.args; - if (command === "subscribe" || command === "psubscribe") { - if (command === "subscribe") { - key = "sub"; - } else { - key = "psub"; - } - for (i = 0; i < args.length; i++) { - this.subscription_set[key + " " + args[i]] = true; - } - } else { - if (command === "unsubscribe") { - key = "sub"; - } else { - key = "psub"; - } - for (i = 0; i < args.length; i++) { - delete this.subscription_set[key + " " + args[i]]; - } - } -}; - -RedisClient.prototype.end = function () { - this.stream._events = {}; - this.connected = false; - this.ready = false; - return this.stream.end(); -}; - -function Multi(client, args) { - this.client = client; - this.queue = [["MULTI"]]; - if (Array.isArray(args)) { - this.queue = this.queue.concat(args); - } -} - -exports.Multi = Multi; - -// take 2 arrays and return the union of their elements -function set_union(seta, setb) { - var obj = {}; - - seta.forEach(function (val) { - obj[val] = true; - }); - setb.forEach(function (val) { - obj[val] = true; - }); - return Object.keys(obj); -} - -// This static list of commands is updated from time to time. ./lib/commands.js can be updated with generate_commands.js -commands = set_union(["get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", - "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", - "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", - "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", - "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", - "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", - "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", - "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", - "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", - "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); - -commands.forEach(function (command) { - RedisClient.prototype[command] = function (args, callback) { - if (Array.isArray(args) && typeof callback === "function") { - return this.send_command(command, args, callback); - } else { - return this.send_command(command, to_array(arguments)); - } - }; - RedisClient.prototype[command.toUpperCase()] = RedisClient.prototype[command]; - - Multi.prototype[command] = function () { - this.queue.push([command].concat(to_array(arguments))); - return this; - }; - Multi.prototype[command.toUpperCase()] = Multi.prototype[command]; -}); - -// store db in this.select_db to restore it on reconnect -RedisClient.prototype.select = function (db, callback) { - var self = this; - - this.send_command('select', [db], function (err, res) { - if (err === null) { - self.selected_db = db; - } - if (typeof(callback) === 'function') { - callback(err, res); - } - }); -}; -RedisClient.prototype.SELECT = RedisClient.prototype.select; - -// Stash auth for connect and reconnect. Send immediately if already connected. -RedisClient.prototype.auth = function () { - var args = to_array(arguments); - this.auth_pass = args[0]; - this.auth_callback = args[1]; - if (exports.debug_mode) { - console.log("Saving auth as " + this.auth_pass); - } - - if (this.connected) { - this.send_command("auth", args); - } -}; -RedisClient.prototype.AUTH = RedisClient.prototype.auth; - -RedisClient.prototype.hmget = function (arg1, arg2, arg3) { - if (Array.isArray(arg2) && typeof arg3 === "function") { - return this.send_command("hmget", [arg1].concat(arg2), arg3); - } else if (Array.isArray(arg1) && typeof arg2 === "function") { - return this.send_command("hmget", arg1, arg2); - } else { - return this.send_command("hmget", to_array(arguments)); - } -}; -RedisClient.prototype.HMGET = RedisClient.prototype.hmget; - -RedisClient.prototype.hmset = function (args, callback) { - var tmp_args, tmp_keys, i, il, key; - - if (Array.isArray(args) && typeof callback === "function") { - return this.send_command("hmset", args, callback); - } - - args = to_array(arguments); - if (typeof args[args.length - 1] === "function") { - callback = args[args.length - 1]; - args.length -= 1; - } else { - callback = null; - } - - if (args.length === 2 && typeof args[0] === "string" && typeof args[1] === "object") { - // User does: client.hmset(key, {key1: val1, key2: val2}) - tmp_args = [ args[0] ]; - tmp_keys = Object.keys(args[1]); - for (i = 0, il = tmp_keys.length; i < il ; i++) { - key = tmp_keys[i]; - tmp_args.push(key); - if (typeof args[1][key] !== "string") { - var err = new Error("hmset expected value to be a string", key, ":", args[1][key]); - if (callback) return callback(err); - else throw err; - } - tmp_args.push(args[1][key]); - } - args = tmp_args; - } - - return this.send_command("hmset", args, callback); -}; -RedisClient.prototype.HMSET = RedisClient.prototype.hmset; - -Multi.prototype.hmset = function () { - var args = to_array(arguments), tmp_args; - if (args.length >= 2 && typeof args[0] === "string" && typeof args[1] === "object") { - tmp_args = [ "hmset", args[0] ]; - Object.keys(args[1]).map(function (key) { - tmp_args.push(key); - tmp_args.push(args[1][key]); - }); - if (args[2]) { - tmp_args.push(args[2]); - } - args = tmp_args; - } else { - args.unshift("hmset"); - } - - this.queue.push(args); - return this; -}; -Multi.prototype.HMSET = Multi.prototype.hmset; - -Multi.prototype.exec = function (callback) { - var self = this; - - // drain queue, callback will catch "QUEUED" or error - // TODO - get rid of all of these anonymous functions which are elegant but slow - this.queue.forEach(function (args, index) { - var command = args[0], obj; - if (typeof args[args.length - 1] === "function") { - args = args.slice(1, -1); - } else { - args = args.slice(1); - } - if (args.length === 1 && Array.isArray(args[0])) { - args = args[0]; - } - if (command.toLowerCase() === 'hmset' && typeof args[1] === 'object') { - obj = args.pop(); - Object.keys(obj).forEach(function (key) { - args.push(key); - args.push(obj[key]); - }); - } - this.client.send_command(command, args, function (err, reply) { - if (err) { - var cur = self.queue[index]; - if (typeof cur[cur.length - 1] === "function") { - cur[cur.length - 1](err); - } else { - throw new Error(err); - } - self.queue.splice(index, 1); - } - }); - }, this); - - // TODO - make this callback part of Multi.prototype instead of creating it each time - return this.client.send_command("EXEC", [], function (err, replies) { - if (err) { - if (callback) { - callback(new Error(err)); - return; - } else { - throw new Error(err); - } - } - - var i, il, j, jl, reply, args; - - if (replies) { - for (i = 1, il = self.queue.length; i < il; i += 1) { - reply = replies[i - 1]; - args = self.queue[i]; - - // TODO - confusing and error-prone that hgetall is special cased in two places - if (reply && args[0].toLowerCase() === "hgetall") { - replies[i - 1] = reply = reply_to_object(reply); - } - - if (typeof args[args.length - 1] === "function") { - args[args.length - 1](null, reply); - } - } - } - - if (callback) { - callback(null, replies); - } - }); -}; -Multi.prototype.EXEC = Multi.prototype.exec; - -RedisClient.prototype.multi = function (args) { - return new Multi(this, args); -}; -RedisClient.prototype.MULTI = function (args) { - return new Multi(this, args); -}; - - -// stash original eval method -var eval = RedisClient.prototype.eval; -// hook eval with an attempt to evalsha for cached scripts -RedisClient.prototype.eval = -RedisClient.prototype.EVAL = function () { - var self = this, - args = to_array(arguments), - callback; - - if (typeof args[args.length - 1] === "function") { - callback = args.pop(); - } - - // replace script source with sha value - var source = args[0]; - args[0] = crypto.createHash("sha1").update(source).digest("hex"); - - self.evalsha(args, function (err, reply) { - if (err && /NOSCRIPT/.test(err.message)) { - args[0] = source; - eval.call(self, args, callback); - - } else if (callback) { - callback(err, reply); - } - }); -}; - - -exports.createClient = function (port_arg, host_arg, options) { - var port = port_arg || default_port, - host = host_arg || default_host, - redis_client, net_client; - - net_client = net.createConnection(port, host); - - redis_client = new RedisClient(net_client, options); - - redis_client.port = port; - redis_client.host = host; - - return redis_client; -}; - -exports.print = function (err, reply) { - if (err) { - console.log("Error: " + err); - } else { - console.log("Reply: " + reply); - } -}; diff --git a/realtime/node_modules/redis/lib/commands.js b/realtime/node_modules/redis/lib/commands.js deleted file mode 100644 index f57cca96..00000000 --- a/realtime/node_modules/redis/lib/commands.js +++ /dev/null @@ -1,147 +0,0 @@ -// This file was generated by ./generate_commands.js on Mon Aug 06 2012 15:04:06 GMT-0700 (PDT) -module.exports = [ - "append", - "auth", - "bgrewriteaof", - "bgsave", - "bitcount", - "bitop", - "blpop", - "brpop", - "brpoplpush", - "client kill", - "client list", - "config get", - "config set", - "config resetstat", - "dbsize", - "debug object", - "debug segfault", - "decr", - "decrby", - "del", - "discard", - "dump", - "echo", - "eval", - "evalsha", - "exec", - "exists", - "expire", - "expireat", - "flushall", - "flushdb", - "get", - "getbit", - "getrange", - "getset", - "hdel", - "hexists", - "hget", - "hgetall", - "hincrby", - "hincrbyfloat", - "hkeys", - "hlen", - "hmget", - "hmset", - "hset", - "hsetnx", - "hvals", - "incr", - "incrby", - "incrbyfloat", - "info", - "keys", - "lastsave", - "lindex", - "linsert", - "llen", - "lpop", - "lpush", - "lpushx", - "lrange", - "lrem", - "lset", - "ltrim", - "mget", - "migrate", - "monitor", - "move", - "mset", - "msetnx", - "multi", - "object", - "persist", - "pexpire", - "pexpireat", - "ping", - "psetex", - "psubscribe", - "pttl", - "publish", - "punsubscribe", - "quit", - "randomkey", - "rename", - "renamenx", - "restore", - "rpop", - "rpoplpush", - "rpush", - "rpushx", - "sadd", - "save", - "scard", - "script exists", - "script flush", - "script kill", - "script load", - "sdiff", - "sdiffstore", - "select", - "set", - "setbit", - "setex", - "setnx", - "setrange", - "shutdown", - "sinter", - "sinterstore", - "sismember", - "slaveof", - "slowlog", - "smembers", - "smove", - "sort", - "spop", - "srandmember", - "srem", - "strlen", - "subscribe", - "sunion", - "sunionstore", - "sync", - "time", - "ttl", - "type", - "unsubscribe", - "unwatch", - "watch", - "zadd", - "zcard", - "zcount", - "zincrby", - "zinterstore", - "zrange", - "zrangebyscore", - "zrank", - "zrem", - "zremrangebyrank", - "zremrangebyscore", - "zrevrange", - "zrevrangebyscore", - "zrevrank", - "zscore", - "zunionstore" -]; diff --git a/realtime/node_modules/redis/lib/parser/hiredis.js b/realtime/node_modules/redis/lib/parser/hiredis.js deleted file mode 100644 index cbb15ba3..00000000 --- a/realtime/node_modules/redis/lib/parser/hiredis.js +++ /dev/null @@ -1,46 +0,0 @@ -/*global Buffer require exports console setTimeout */ - -var events = require("events"), - util = require("../util"), - hiredis = require("hiredis"); - -exports.debug_mode = false; -exports.name = "hiredis"; - -function HiredisReplyParser(options) { - this.name = exports.name; - this.options = options || {}; - this.reset(); - events.EventEmitter.call(this); -} - -util.inherits(HiredisReplyParser, events.EventEmitter); - -exports.Parser = HiredisReplyParser; - -HiredisReplyParser.prototype.reset = function () { - this.reader = new hiredis.Reader({ - return_buffers: this.options.return_buffers || false - }); -}; - -HiredisReplyParser.prototype.execute = function (data) { - var reply; - this.reader.feed(data); - while (true) { - try { - reply = this.reader.get(); - } catch (err) { - this.emit("error", err); - break; - } - - if (reply === undefined) break; - - if (reply && reply.constructor === Error) { - this.emit("reply error", reply); - } else { - this.emit("reply", reply); - } - } -}; diff --git a/realtime/node_modules/redis/lib/parser/javascript.js b/realtime/node_modules/redis/lib/parser/javascript.js deleted file mode 100644 index b8f5bc68..00000000 --- a/realtime/node_modules/redis/lib/parser/javascript.js +++ /dev/null @@ -1,317 +0,0 @@ -/*global Buffer require exports console setTimeout */ - -// TODO - incorporate these V8 pro tips: -// pre-allocate Arrays if length is known in advance -// do not use delete -// use numbers for parser state - -var events = require("events"), - util = require("../util"); - -exports.debug_mode = false; -exports.name = "javascript"; - -function RedisReplyParser(options) { - this.name = exports.name; - this.options = options || {}; - this.reset(); - events.EventEmitter.call(this); -} - -util.inherits(RedisReplyParser, events.EventEmitter); - -exports.Parser = RedisReplyParser; - -// Buffer.toString() is quite slow for small strings -function small_toString(buf, len) { - var tmp = "", i; - - for (i = 0; i < len; i += 1) { - tmp += String.fromCharCode(buf[i]); - } - - return tmp; -} - -// Reset parser to it's original state. -RedisReplyParser.prototype.reset = function () { - this.return_buffer = new Buffer(16384); // for holding replies, might grow - this.return_string = ""; - this.tmp_string = ""; // for holding size fields - - this.multi_bulk_length = 0; - this.multi_bulk_replies = null; - this.multi_bulk_pos = 0; - this.multi_bulk_nested_length = 0; - this.multi_bulk_nested_replies = null; - - this.states = { - TYPE: 1, - SINGLE_LINE: 2, - MULTI_BULK_COUNT: 3, - INTEGER_LINE: 4, - BULK_LENGTH: 5, - ERROR_LINE: 6, - BULK_DATA: 7, - UNKNOWN_TYPE: 8, - FINAL_CR: 9, - FINAL_LF: 10, - MULTI_BULK_COUNT_LF: 11, - BULK_LF: 12 - }; - - this.state = this.states.TYPE; -}; - -RedisReplyParser.prototype.parser_error = function (message) { - this.emit("error", message); - this.reset(); -}; - -RedisReplyParser.prototype.execute = function (incoming_buf) { - var pos = 0, bd_tmp, bd_str, i, il, states = this.states; - //, state_times = {}, start_execute = new Date(), start_switch, end_switch, old_state; - //start_switch = new Date(); - - while (pos < incoming_buf.length) { - // old_state = this.state; - // console.log("execute: " + this.state + ", " + pos + "/" + incoming_buf.length + ", " + String.fromCharCode(incoming_buf[pos])); - - switch (this.state) { - case 1: // states.TYPE - this.type = incoming_buf[pos]; - pos += 1; - - switch (this.type) { - case 43: // + - this.state = states.SINGLE_LINE; - this.return_buffer.end = 0; - this.return_string = ""; - break; - case 42: // * - this.state = states.MULTI_BULK_COUNT; - this.tmp_string = ""; - break; - case 58: // : - this.state = states.INTEGER_LINE; - this.return_buffer.end = 0; - this.return_string = ""; - break; - case 36: // $ - this.state = states.BULK_LENGTH; - this.tmp_string = ""; - break; - case 45: // - - this.state = states.ERROR_LINE; - this.return_buffer.end = 0; - this.return_string = ""; - break; - default: - this.state = states.UNKNOWN_TYPE; - } - break; - case 4: // states.INTEGER_LINE - if (incoming_buf[pos] === 13) { - this.send_reply(+small_toString(this.return_buffer, this.return_buffer.end)); - this.state = states.FINAL_LF; - } else { - this.return_buffer[this.return_buffer.end] = incoming_buf[pos]; - this.return_buffer.end += 1; - } - pos += 1; - break; - case 6: // states.ERROR_LINE - if (incoming_buf[pos] === 13) { - this.send_error(this.return_buffer.toString("ascii", 0, this.return_buffer.end)); - this.state = states.FINAL_LF; - } else { - this.return_buffer[this.return_buffer.end] = incoming_buf[pos]; - this.return_buffer.end += 1; - } - pos += 1; - break; - case 2: // states.SINGLE_LINE - if (incoming_buf[pos] === 13) { - this.send_reply(this.return_string); - this.state = states.FINAL_LF; - } else { - this.return_string += String.fromCharCode(incoming_buf[pos]); - } - pos += 1; - break; - case 3: // states.MULTI_BULK_COUNT - if (incoming_buf[pos] === 13) { // \r - this.state = states.MULTI_BULK_COUNT_LF; - } else { - this.tmp_string += String.fromCharCode(incoming_buf[pos]); - } - pos += 1; - break; - case 11: // states.MULTI_BULK_COUNT_LF - if (incoming_buf[pos] === 10) { // \n - if (this.multi_bulk_length) { // nested multi-bulk - this.multi_bulk_nested_length = this.multi_bulk_length; - this.multi_bulk_nested_replies = this.multi_bulk_replies; - this.multi_bulk_nested_pos = this.multi_bulk_pos; - } - this.multi_bulk_length = +this.tmp_string; - this.multi_bulk_pos = 0; - this.state = states.TYPE; - if (this.multi_bulk_length < 0) { - this.send_reply(null); - this.multi_bulk_length = 0; - } else if (this.multi_bulk_length === 0) { - this.multi_bulk_pos = 0; - this.multi_bulk_replies = null; - this.send_reply([]); - } else { - this.multi_bulk_replies = new Array(this.multi_bulk_length); - } - } else { - this.parser_error(new Error("didn't see LF after NL reading multi bulk count")); - return; - } - pos += 1; - break; - case 5: // states.BULK_LENGTH - if (incoming_buf[pos] === 13) { // \r - this.state = states.BULK_LF; - } else { - this.tmp_string += String.fromCharCode(incoming_buf[pos]); - } - pos += 1; - break; - case 12: // states.BULK_LF - if (incoming_buf[pos] === 10) { // \n - this.bulk_length = +this.tmp_string; - if (this.bulk_length === -1) { - this.send_reply(null); - this.state = states.TYPE; - } else if (this.bulk_length === 0) { - this.send_reply(new Buffer("")); - this.state = states.FINAL_CR; - } else { - this.state = states.BULK_DATA; - if (this.bulk_length > this.return_buffer.length) { - if (exports.debug_mode) { - console.log("Growing return_buffer from " + this.return_buffer.length + " to " + this.bulk_length); - } - this.return_buffer = new Buffer(this.bulk_length); - } - this.return_buffer.end = 0; - } - } else { - this.parser_error(new Error("didn't see LF after NL while reading bulk length")); - return; - } - pos += 1; - break; - case 7: // states.BULK_DATA - this.return_buffer[this.return_buffer.end] = incoming_buf[pos]; - this.return_buffer.end += 1; - pos += 1; - if (this.return_buffer.end === this.bulk_length) { - bd_tmp = new Buffer(this.bulk_length); - // When the response is small, Buffer.copy() is a lot slower. - if (this.bulk_length > 10) { - this.return_buffer.copy(bd_tmp, 0, 0, this.bulk_length); - } else { - for (i = 0, il = this.bulk_length; i < il; i += 1) { - bd_tmp[i] = this.return_buffer[i]; - } - } - this.send_reply(bd_tmp); - this.state = states.FINAL_CR; - } - break; - case 9: // states.FINAL_CR - if (incoming_buf[pos] === 13) { // \r - this.state = states.FINAL_LF; - pos += 1; - } else { - this.parser_error(new Error("saw " + incoming_buf[pos] + " when expecting final CR")); - return; - } - break; - case 10: // states.FINAL_LF - if (incoming_buf[pos] === 10) { // \n - this.state = states.TYPE; - pos += 1; - } else { - this.parser_error(new Error("saw " + incoming_buf[pos] + " when expecting final LF")); - return; - } - break; - default: - this.parser_error(new Error("invalid state " + this.state)); - } - // end_switch = new Date(); - // if (state_times[old_state] === undefined) { - // state_times[old_state] = 0; - // } - // state_times[old_state] += (end_switch - start_switch); - // start_switch = end_switch; - } - // console.log("execute ran for " + (Date.now() - start_execute) + " ms, on " + incoming_buf.length + " Bytes. "); - // Object.keys(state_times).forEach(function (state) { - // console.log(" " + state + ": " + state_times[state]); - // }); -}; - -RedisReplyParser.prototype.send_error = function (reply) { - if (this.multi_bulk_length > 0 || this.multi_bulk_nested_length > 0) { - // TODO - can this happen? Seems like maybe not. - this.add_multi_bulk_reply(reply); - } else { - this.emit("reply error", reply); - } -}; - -RedisReplyParser.prototype.send_reply = function (reply) { - if (this.multi_bulk_length > 0 || this.multi_bulk_nested_length > 0) { - if (!this.options.return_buffers && Buffer.isBuffer(reply)) { - this.add_multi_bulk_reply(reply.toString("utf8")); - } else { - this.add_multi_bulk_reply(reply); - } - } else { - if (!this.options.return_buffers && Buffer.isBuffer(reply)) { - this.emit("reply", reply.toString("utf8")); - } else { - this.emit("reply", reply); - } - } -}; - -RedisReplyParser.prototype.add_multi_bulk_reply = function (reply) { - if (this.multi_bulk_replies) { - this.multi_bulk_replies[this.multi_bulk_pos] = reply; - this.multi_bulk_pos += 1; - if (this.multi_bulk_pos < this.multi_bulk_length) { - return; - } - } else { - this.multi_bulk_replies = reply; - } - - if (this.multi_bulk_nested_length > 0) { - this.multi_bulk_nested_replies[this.multi_bulk_nested_pos] = this.multi_bulk_replies; - this.multi_bulk_nested_pos += 1; - - this.multi_bulk_length = 0; - this.multi_bulk_replies = null; - this.multi_bulk_pos = 0; - - if (this.multi_bulk_nested_length === this.multi_bulk_nested_pos) { - this.emit("reply", this.multi_bulk_nested_replies); - this.multi_bulk_nested_length = 0; - this.multi_bulk_nested_pos = 0; - this.multi_bulk_nested_replies = null; - } - } else { - this.emit("reply", this.multi_bulk_replies); - this.multi_bulk_length = 0; - this.multi_bulk_replies = null; - this.multi_bulk_pos = 0; - } -}; diff --git a/realtime/node_modules/redis/lib/queue.js b/realtime/node_modules/redis/lib/queue.js deleted file mode 100644 index 56254e1c..00000000 --- a/realtime/node_modules/redis/lib/queue.js +++ /dev/null @@ -1,61 +0,0 @@ -var to_array = require("./to_array"); - -// Queue class adapted from Tim Caswell's pattern library -// http://github.com/creationix/pattern/blob/master/lib/pattern/queue.js - -function Queue() { - this.tail = []; - this.head = []; - this.offset = 0; -} - -Queue.prototype.shift = function () { - if (this.offset === this.head.length) { - var tmp = this.head; - tmp.length = 0; - this.head = this.tail; - this.tail = tmp; - this.offset = 0; - if (this.head.length === 0) { - return; - } - } - return this.head[this.offset++]; // sorry, JSLint -}; - -Queue.prototype.push = function (item) { - return this.tail.push(item); -}; - -Queue.prototype.forEach = function (fn, thisv) { - var array = this.head.slice(this.offset), i, il; - - array.push.apply(array, this.tail); - - if (thisv) { - for (i = 0, il = array.length; i < il; i += 1) { - fn.call(thisv, array[i], i, array); - } - } else { - for (i = 0, il = array.length; i < il; i += 1) { - fn(array[i], i, array); - } - } - - return array; -}; - -Queue.prototype.getLength = function () { - return this.head.length - this.offset + this.tail.length; -}; - -Object.defineProperty(Queue.prototype, 'length', { - get: function () { - return this.getLength(); - } -}); - - -if(typeof module !== 'undefined' && module.exports) { - module.exports = Queue; -} diff --git a/realtime/node_modules/redis/lib/to_array.js b/realtime/node_modules/redis/lib/to_array.js deleted file mode 100644 index 88a57e18..00000000 --- a/realtime/node_modules/redis/lib/to_array.js +++ /dev/null @@ -1,12 +0,0 @@ -function to_array(args) { - var len = args.length, - arr = new Array(len), i; - - for (i = 0; i < len; i += 1) { - arr[i] = args[i]; - } - - return arr; -} - -module.exports = to_array; diff --git a/realtime/node_modules/redis/lib/util.js b/realtime/node_modules/redis/lib/util.js deleted file mode 100644 index fc255ae9..00000000 --- a/realtime/node_modules/redis/lib/util.js +++ /dev/null @@ -1,11 +0,0 @@ -// Support for very old versions of node where the module was called "sys". At some point, we should abandon this. - -var util; - -try { - util = require("util"); -} catch (err) { - util = require("sys"); -} - -module.exports = util; diff --git a/realtime/node_modules/redis/mem.js b/realtime/node_modules/redis/mem.js deleted file mode 100644 index 5144ab28..00000000 --- a/realtime/node_modules/redis/mem.js +++ /dev/null @@ -1,11 +0,0 @@ -var client = require("redis").createClient(); - -client.set("foo", "barvalskdjlksdjflkdsjflksdjdflkdsjflksdjflksdj", function (err, res) { - if (err) { - console.log("Got an error, please adapt somehow."); - } else { - console.log("Got a result: " + res); - } -}); - -client.quit(); diff --git a/realtime/node_modules/redis/multi_bench.js b/realtime/node_modules/redis/multi_bench.js deleted file mode 100644 index 5be2e564..00000000 --- a/realtime/node_modules/redis/multi_bench.js +++ /dev/null @@ -1,225 +0,0 @@ -var redis = require("./index"), - metrics = require("metrics"), - num_clients = parseInt(process.argv[2], 10) || 5, - num_requests = 20000, - tests = [], - versions_logged = false, - client_options = { - return_buffers: false - }, - small_str, large_str, small_buf, large_buf; - -redis.debug_mode = false; - -function lpad(input, len, chr) { - var str = input.toString(); - chr = chr || " "; - - while (str.length < len) { - str = chr + str; - } - return str; -} - -metrics.Histogram.prototype.print_line = function () { - var obj = this.printObj(); - - return lpad(obj.min, 4) + "/" + lpad(obj.max, 4) + "/" + lpad(obj.mean.toFixed(2), 7) + "/" + lpad(obj.p95.toFixed(2), 7); -}; - -function Test(args) { - var self = this; - - this.args = args; - - this.callback = null; - this.clients = []; - this.clients_ready = 0; - this.commands_sent = 0; - this.commands_completed = 0; - this.max_pipeline = this.args.pipeline || num_requests; - this.client_options = args.client_options || client_options; - - this.connect_latency = new metrics.Histogram(); - this.ready_latency = new metrics.Histogram(); - this.command_latency = new metrics.Histogram(); -} - -Test.prototype.run = function (callback) { - var self = this, i; - - this.callback = callback; - - for (i = 0; i < num_clients ; i++) { - this.new_client(i); - } -}; - -Test.prototype.new_client = function (id) { - var self = this, new_client; - - new_client = redis.createClient(6379, "127.0.0.1", this.client_options); - new_client.create_time = Date.now(); - - new_client.on("connect", function () { - self.connect_latency.update(Date.now() - new_client.create_time); - }); - - new_client.on("ready", function () { - if (! versions_logged) { - console.log("Client count: " + num_clients + ", node version: " + process.versions.node + ", server version: " + - new_client.server_info.redis_version + ", parser: " + new_client.reply_parser.name); - versions_logged = true; - } - self.ready_latency.update(Date.now() - new_client.create_time); - self.clients_ready++; - if (self.clients_ready === self.clients.length) { - self.on_clients_ready(); - } - }); - - self.clients[id] = new_client; -}; - -Test.prototype.on_clients_ready = function () { - process.stdout.write(lpad(this.args.descr, 13) + ", " + lpad(this.args.pipeline, 5) + "/" + this.clients_ready + " "); - this.test_start = Date.now(); - - this.fill_pipeline(); -}; - -Test.prototype.fill_pipeline = function () { - var pipeline = this.commands_sent - this.commands_completed; - - while (this.commands_sent < num_requests && pipeline < this.max_pipeline) { - this.commands_sent++; - pipeline++; - this.send_next(); - } - - if (this.commands_completed === num_requests) { - this.print_stats(); - this.stop_clients(); - } -}; - -Test.prototype.stop_clients = function () { - var self = this; - - this.clients.forEach(function (client, pos) { - if (pos === self.clients.length - 1) { - client.quit(function (err, res) { - self.callback(); - }); - } else { - client.quit(); - } - }); -}; - -Test.prototype.send_next = function () { - var self = this, - cur_client = this.commands_sent % this.clients.length, - command_num = this.commands_sent, - start = Date.now(); - - this.clients[cur_client][this.args.command](this.args.args, function (err, res) { - if (err) { - throw err; - } - self.commands_completed++; - self.command_latency.update(Date.now() - start); - self.fill_pipeline(); - }); -}; - -Test.prototype.print_stats = function () { - var duration = Date.now() - this.test_start; - - console.log("min/max/avg/p95: " + this.command_latency.print_line() + " " + lpad(duration, 6) + "ms total, " + - lpad((num_requests / (duration / 1000)).toFixed(2), 8) + " ops/sec"); -}; - -small_str = "1234"; -small_buf = new Buffer(small_str); -large_str = (new Array(4097).join("-")); -large_buf = new Buffer(large_str); - -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 1})); -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 50})); -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 200})); -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 20000})); - -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 1})); -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 50})); -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 200})); -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 20000})); - -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 1})); -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 50})); -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 200})); -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 20000})); - -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 1})); -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 50})); -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 200})); -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 20000})); - -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 1, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 50, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 200, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 20000, client_opts: { return_buffers: true} })); - -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 1})); -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 50})); -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 200})); -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 20000})); - -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 1})); -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 50})); -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 200})); -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 20000})); - -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 1})); -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 50})); -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 200})); -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 20000})); - -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 1, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 50, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 200, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 20000, client_opts: { return_buffers: true} })); - -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 1})); -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 50})); -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 200})); -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 20000})); - -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 1})); -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 50})); -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 200})); -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 20000})); - -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 1})); -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 50})); -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 200})); -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 20000})); - -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 1})); -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 50})); -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 200})); -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 20000})); - -function next() { - var test = tests.shift(); - if (test) { - test.run(function () { - next(); - }); - } else { - console.log("End of tests."); - process.exit(0); - } -} - -next(); diff --git a/realtime/node_modules/redis/package.json b/realtime/node_modules/redis/package.json deleted file mode 100644 index 72197a8c..00000000 --- a/realtime/node_modules/redis/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "redis", - "version": "0.7.3", - "description": "Redis client library", - "author": { - "name": "Matt Ranney", - "email": "mjr@ranney.com" - }, - "maintainers": [ - { - "name": "David Trejo", - "email": "david.daniel.trejo@gmail.com", - "url": "http://dtrejo.com/" - } - ], - "main": "./index.js", - "scripts": { - "test": "node ./test.js" - }, - "devDependencies": { - "metrics": ">=0.1.5" - }, - "repository": { - "type": "git", - "url": "git://github.com/mranney/node_redis.git" - }, - "_id": "redis@0.7.3", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "e8b3c2a488b9d00b47570afb01577bebd6f7aa6f" - }, - "_from": "redis@0.7.3" -} diff --git a/realtime/node_modules/redis/test.js b/realtime/node_modules/redis/test.js deleted file mode 100644 index 0a03375e..00000000 --- a/realtime/node_modules/redis/test.js +++ /dev/null @@ -1,1618 +0,0 @@ -/*global require console setTimeout process Buffer */ -var redis = require("./index"), - client = redis.createClient(), - client2 = redis.createClient(), - client3 = redis.createClient(), - assert = require("assert"), - crypto = require("crypto"), - util = require("./lib/util"), - test_db_num = 15, // this DB will be flushed and used for testing - tests = {}, - connected = false, - ended = false, - next, cur_start, run_next_test, all_tests, all_start, test_count; - -// Set this to truthy to see the wire protocol and other debugging info -redis.debug_mode = process.argv[2]; - -function buffers_to_strings(arr) { - return arr.map(function (val) { - return val.toString(); - }); -} - -function require_number(expected, label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected " + expected + ", got error: " + err); - assert.strictEqual(expected, results, label + " " + expected + " !== " + results); - assert.strictEqual(typeof results, "number", label); - return true; - }; -} - -function require_number_any(label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected any number, got error: " + err); - assert.strictEqual(typeof results, "number", label + " " + results + " is not a number"); - return true; - }; -} - -function require_number_pos(label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected positive number, got error: " + err); - assert.strictEqual(true, (results > 0), label + " " + results + " is not a positive number"); - return true; - }; -} - -function require_string(str, label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected string '" + str + "', got error: " + err); - assert.equal(str, results, label + " " + str + " does not match " + results); - return true; - }; -} - -function require_null(label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected null, got error: " + err); - assert.strictEqual(null, results, label + ": " + results + " is not null"); - return true; - }; -} - -function require_error(label) { - return function (err, results) { - assert.notEqual(err, null, label + " err is null, but an error is expected here."); - return true; - }; -} - -function is_empty_array(obj) { - return Array.isArray(obj) && obj.length === 0; -} - -function last(name, fn) { - return function (err, results) { - fn(err, results); - next(name); - }; -} - -next = function next(name) { - console.log(" \x1b[33m" + (Date.now() - cur_start) + "\x1b[0m ms"); - run_next_test(); -}; - -// Tests are run in the order they are defined. So FLUSHDB should be stay first. - -tests.FLUSHDB = function () { - var name = "FLUSHDB"; - client.select(test_db_num, require_string("OK", name)); - client2.select(test_db_num, require_string("OK", name)); - client3.select(test_db_num, require_string("OK", name)); - client.mset("flush keys 1", "flush val 1", "flush keys 2", "flush val 2", require_string("OK", name)); - client.FLUSHDB(require_string("OK", name)); - client.dbsize(last(name, require_number(0, name))); -}; - -tests.MULTI_1 = function () { - var name = "MULTI_1", multi1, multi2; - - // Provoke an error at queue time - multi1 = client.multi(); - multi1.mset("multifoo", "10", "multibar", "20", require_string("OK", name)); - multi1.set("foo2", require_error(name)); - multi1.incr("multifoo", require_number(11, name)); - multi1.incr("multibar", require_number(21, name)); - multi1.exec(); - - // Confirm that the previous command, while containing an error, still worked. - multi2 = client.multi(); - multi2.incr("multibar", require_number(22, name)); - multi2.incr("multifoo", require_number(12, name)); - multi2.exec(function (err, replies) { - assert.strictEqual(22, replies[0]); - assert.strictEqual(12, replies[1]); - next(name); - }); -}; - -tests.MULTI_2 = function () { - var name = "MULTI_2"; - - // test nested multi-bulk replies - client.multi([ - ["mget", "multifoo", "multibar", function (err, res) { - assert.strictEqual(2, res.length, name); - assert.strictEqual("12", res[0].toString(), name); - assert.strictEqual("22", res[1].toString(), name); - }], - ["set", "foo2", require_error(name)], - ["incr", "multifoo", require_number(13, name)], - ["incr", "multibar", require_number(23, name)] - ]).exec(function (err, replies) { - assert.strictEqual(2, replies[0].length, name); - assert.strictEqual("12", replies[0][0].toString(), name); - assert.strictEqual("22", replies[0][1].toString(), name); - - assert.strictEqual("13", replies[1].toString()); - assert.strictEqual("23", replies[2].toString()); - next(name); - }); -}; - -tests.MULTI_3 = function () { - var name = "MULTI_3"; - - client.sadd("some set", "mem 1"); - client.sadd("some set", "mem 2"); - client.sadd("some set", "mem 3"); - client.sadd("some set", "mem 4"); - - // make sure empty mb reply works - client.del("some missing set"); - client.smembers("some missing set", function (err, reply) { - // make sure empty mb reply works - assert.strictEqual(true, is_empty_array(reply), name); - }); - - // test nested multi-bulk replies with empty mb elements. - client.multi([ - ["smembers", "some set"], - ["del", "some set"], - ["smembers", "some set"] - ]) - .scard("some set") - .exec(function (err, replies) { - assert.strictEqual(true, is_empty_array(replies[2]), name); - next(name); - }); -}; - -tests.MULTI_4 = function () { - var name = "MULTI_4"; - - client.multi() - .mset('some', '10', 'keys', '20') - .incr('some') - .incr('keys') - .mget('some', 'keys') - .exec(function (err, replies) { - assert.strictEqual(null, err); - assert.equal('OK', replies[0]); - assert.equal(11, replies[1]); - assert.equal(21, replies[2]); - assert.equal(11, replies[3][0].toString()); - assert.equal(21, replies[3][1].toString()); - next(name); - }); -}; - -tests.MULTI_5 = function () { - var name = "MULTI_5"; - - // test nested multi-bulk replies with nulls. - client.multi([ - ["mget", ["multifoo", "some", "random value", "keys"]], - ["incr", "multifoo"] - ]) - .exec(function (err, replies) { - assert.strictEqual(replies.length, 2, name); - assert.strictEqual(replies[0].length, 4, name); - next(name); - }); -}; - -tests.MULTI_6 = function () { - var name = "MULTI_6"; - - client.multi() - .hmset("multihash", "a", "foo", "b", 1) - .hmset("multihash", { - extra: "fancy", - things: "here" - }) - .hgetall("multihash") - .exec(function (err, replies) { - assert.strictEqual(null, err); - assert.equal("OK", replies[0]); - assert.equal(Object.keys(replies[2]).length, 4); - assert.equal("foo", replies[2].a); - assert.equal("1", replies[2].b); - assert.equal("fancy", replies[2].extra); - assert.equal("here", replies[2].things); - next(name); - }); -}; - -tests.EVAL_1 = function () { - var name = "EVAL_1"; - - if (client.server_info.versions[0] >= 2 && client.server_info.versions[1] >= 5) { - // test {EVAL - Lua integer -> Redis protocol type conversion} - client.eval("return 100.5", 0, require_number(100, name)); - // test {EVAL - Lua string -> Redis protocol type conversion} - client.eval("return 'hello world'", 0, require_string("hello world", name)); - // test {EVAL - Lua true boolean -> Redis protocol type conversion} - client.eval("return true", 0, require_number(1, name)); - // test {EVAL - Lua false boolean -> Redis protocol type conversion} - client.eval("return false", 0, require_null(name)); - // test {EVAL - Lua status code reply -> Redis protocol type conversion} - client.eval("return {ok='fine'}", 0, require_string("fine", name)); - // test {EVAL - Lua error reply -> Redis protocol type conversion} - client.eval("return {err='this is an error'}", 0, require_error(name)); - // test {EVAL - Lua table -> Redis protocol type conversion} - client.eval("return {1,2,3,'ciao',{1,2}}", 0, function (err, res) { - assert.strictEqual(5, res.length, name); - assert.strictEqual(1, res[0], name); - assert.strictEqual(2, res[1], name); - assert.strictEqual(3, res[2], name); - assert.strictEqual("ciao", res[3], name); - assert.strictEqual(2, res[4].length, name); - assert.strictEqual(1, res[4][0], name); - assert.strictEqual(2, res[4][1], name); - }); - // test {EVAL - Are the KEYS and ARGS arrays populated correctly?} - client.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d", function (err, res) { - assert.strictEqual(4, res.length, name); - assert.strictEqual("a", res[0], name); - assert.strictEqual("b", res[1], name); - assert.strictEqual("c", res[2], name); - assert.strictEqual("d", res[3], name); - }); - - // prepare sha sum for evalsha cache test - var source = "return redis.call('get', 'sha test')", - sha = crypto.createHash('sha1').update(source).digest('hex'); - - client.set("sha test", "eval get sha test", function (err, res) { - if (err) throw err; - // test {EVAL - is Lua able to call Redis API?} - client.eval(source, 0, function (err, res) { - require_string("eval get sha test", name)(err, res); - // test {EVALSHA - Can we call a SHA1 if already defined?} - client.evalsha(sha, 0, require_string("eval get sha test", name)); - // test {EVALSHA - Do we get an error on non defined SHA1?} - client.evalsha("ffffffffffffffffffffffffffffffffffffffff", 0, require_error(name)); - }); - }); - - // test {EVAL - Redis integer -> Lua type conversion} - client.set("incr key", 0, function (err, reply) { - if (err) throw err; - client.eval("local foo = redis.call('incr','incr key')\n" + "return {type(foo),foo}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("number", res[0], name); - assert.strictEqual(1, res[1], name); - }); - }); - - client.set("bulk reply key", "bulk reply value", function (err, res) { - // test {EVAL - Redis bulk -> Lua type conversion} - client.eval("local foo = redis.call('get','bulk reply key'); return {type(foo),foo}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("string", res[0], name); - assert.strictEqual("bulk reply value", res[1], name); - }); - }); - - // test {EVAL - Redis multi bulk -> Lua type conversion} - client.multi() - .del("mylist") - .rpush("mylist", "a") - .rpush("mylist", "b") - .rpush("mylist", "c") - .exec(function (err, replies) { - if (err) throw err; - client.eval("local foo = redis.call('lrange','mylist',0,-1); return {type(foo),foo[1],foo[2],foo[3],# foo}", 0, function (err, res) { - assert.strictEqual(5, res.length, name); - assert.strictEqual("table", res[0], name); - assert.strictEqual("a", res[1], name); - assert.strictEqual("b", res[2], name); - assert.strictEqual("c", res[3], name); - assert.strictEqual(3, res[4], name); - }); - }); - // test {EVAL - Redis status reply -> Lua type conversion} - client.eval("local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("table", res[0], name); - assert.strictEqual("OK", res[1], name); - }); - // test {EVAL - Redis error reply -> Lua type conversion} - client.set("error reply key", "error reply value", function (err, res) { - if (err) throw err; - client.eval("local foo = redis.pcall('incr','error reply key'); return {type(foo),foo['err']}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("table", res[0], name); - assert.strictEqual("ERR value is not an integer or out of range", res[1], name); - }); - }); - // test {EVAL - Redis nil bulk reply -> Lua type conversion} - client.del("nil reply key", function (err, res) { - if (err) throw err; - client.eval("local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("boolean", res[0], name); - assert.strictEqual(1, res[1], name); - next(name); - }); - }); - } else { - console.log("Skipping " + name + " because server version isn't new enough."); - next(name); - } -}; - -tests.WATCH_MULTI = function () { - var name = 'WATCH_MULTI', multi; - - if (client.server_info.versions[0] >= 2 && client.server_info.versions[1] >= 1) { - client.watch(name); - client.incr(name); - multi = client.multi(); - multi.incr(name); - multi.exec(last(name, require_null(name))); - } else { - console.log("Skipping " + name + " because server version isn't new enough."); - next(name); - } -}; - -tests.detect_buffers = function () { - var name = "detect_buffers", detect_client = redis.createClient(null, null, {detect_buffers: true}); - - detect_client.on("ready", function () { - // single Buffer or String - detect_client.set("string key 1", "string value"); - detect_client.get("string key 1", require_string("string value", name)); - detect_client.get(new Buffer("string key 1"), function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Buffer.isBuffer(reply), name); - assert.strictEqual("", reply.inspect(), name); - }); - - detect_client.hmset("hash key 2", "key 1", "val 1", "key 2", "val 2"); - // array of Buffers or Strings - detect_client.hmget("hash key 2", "key 1", "key 2", function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Array.isArray(reply), name); - assert.strictEqual(2, reply.length, name); - assert.strictEqual("val 1", reply[0], name); - assert.strictEqual("val 2", reply[1], name); - }); - detect_client.hmget(new Buffer("hash key 2"), "key 1", "key 2", function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Array.isArray(reply)); - assert.strictEqual(2, reply.length, name); - assert.strictEqual(true, Buffer.isBuffer(reply[0])); - assert.strictEqual(true, Buffer.isBuffer(reply[1])); - assert.strictEqual("", reply[0].inspect(), name); - assert.strictEqual("", reply[1].inspect(), name); - }); - - // Object of Buffers or Strings - detect_client.hgetall("hash key 2", function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual("object", typeof reply, name); - assert.strictEqual(2, Object.keys(reply).length, name); - assert.strictEqual("val 1", reply["key 1"], name); - assert.strictEqual("val 2", reply["key 2"], name); - }); - detect_client.hgetall(new Buffer("hash key 2"), function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual("object", typeof reply, name); - assert.strictEqual(2, Object.keys(reply).length, name); - assert.strictEqual(true, Buffer.isBuffer(reply["key 1"])); - assert.strictEqual(true, Buffer.isBuffer(reply["key 2"])); - assert.strictEqual("", reply["key 1"].inspect(), name); - assert.strictEqual("", reply["key 2"].inspect(), name); - }); - - detect_client.quit(function (err, res) { - next(name); - }); - }); -}; - -tests.socket_nodelay = function () { - var name = "socket_nodelay", c1, c2, c3, ready_count = 0, quit_count = 0; - - c1 = redis.createClient(null, null, {socket_nodelay: true}); - c2 = redis.createClient(null, null, {socket_nodelay: false}); - c3 = redis.createClient(null, null); - - function quit_check() { - quit_count++; - - if (quit_count === 3) { - next(name); - } - } - - function run() { - assert.strictEqual(true, c1.options.socket_nodelay, name); - assert.strictEqual(false, c2.options.socket_nodelay, name); - assert.strictEqual(true, c3.options.socket_nodelay, name); - - c1.set(["set key 1", "set val"], require_string("OK", name)); - c1.set(["set key 2", "set val"], require_string("OK", name)); - c1.get(["set key 1"], require_string("set val", name)); - c1.get(["set key 2"], require_string("set val", name)); - - c2.set(["set key 3", "set val"], require_string("OK", name)); - c2.set(["set key 4", "set val"], require_string("OK", name)); - c2.get(["set key 3"], require_string("set val", name)); - c2.get(["set key 4"], require_string("set val", name)); - - c3.set(["set key 5", "set val"], require_string("OK", name)); - c3.set(["set key 6", "set val"], require_string("OK", name)); - c3.get(["set key 5"], require_string("set val", name)); - c3.get(["set key 6"], require_string("set val", name)); - - c1.quit(quit_check); - c2.quit(quit_check); - c3.quit(quit_check); - } - - function ready_check() { - ready_count++; - if (ready_count === 3) { - run(); - } - } - - c1.on("ready", ready_check); - c2.on("ready", ready_check); - c3.on("ready", ready_check); -}; - -tests.reconnect = function () { - var name = "reconnect"; - - client.set("recon 1", "one"); - client.set("recon 2", "two", function (err, res) { - // Do not do this in normal programs. This is to simulate the server closing on us. - // For orderly shutdown in normal programs, do client.quit() - client.stream.destroy(); - }); - - client.on("reconnecting", function on_recon(params) { - client.on("connect", function on_connect() { - client.select(test_db_num, require_string("OK", name)); - client.get("recon 1", require_string("one", name)); - client.get("recon 1", require_string("one", name)); - client.get("recon 2", require_string("two", name)); - client.get("recon 2", require_string("two", name)); - client.removeListener("connect", on_connect); - client.removeListener("reconnecting", on_recon); - next(name); - }); - }); -}; - -tests.idle = function () { - var name = "idle"; - - client.on("idle", function on_idle() { - client.removeListener("idle", on_idle); - next(name); - }); - - client.set("idle", "test"); -}; - -tests.HSET = function () { - var key = "test hash", - field1 = new Buffer("0123456789"), - value1 = new Buffer("abcdefghij"), - field2 = new Buffer(0), - value2 = new Buffer(0), - name = "HSET"; - - client.HSET(key, field1, value1, require_number(1, name)); - client.HGET(key, field1, require_string(value1.toString(), name)); - - // Empty value - client.HSET(key, field1, value2, require_number(0, name)); - client.HGET([key, field1], require_string("", name)); - - // Empty key, empty value - client.HSET([key, field2, value1], require_number(1, name)); - client.HSET(key, field2, value2, last(name, require_number(0, name))); -}; - -tests.HLEN = function () { - var key = "test hash", - field1 = new Buffer("0123456789"), - value1 = new Buffer("abcdefghij"), - field2 = new Buffer(0), - value2 = new Buffer(0), - name = "HSET", - timeout = 1000; - - client.HSET(key, field1, value1, function (err, results) { - client.HLEN(key, function (err, len) { - assert.ok(2 === +len); - next(name); - }); - }); -} - -tests.HMSET_BUFFER_AND_ARRAY = function () { - // Saving a buffer and an array to the same key should not error - var key = "test hash", - field1 = "buffer", - value1 = new Buffer("abcdefghij"), - field2 = "array", - value2 = ["array contents"], - name = "HSET"; - - client.HMSET(key, field1, value1, field2, value2, last(name, require_string("OK", name))); -}; - -// TODO - add test for HMSET with optional callbacks - -tests.HMGET = function () { - var key1 = "test hash 1", key2 = "test hash 2", name = "HMGET"; - - // redis-like hmset syntax - client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value", require_string("OK", name)); - - // fancy hmset syntax - client.HMSET(key2, { - "0123456789": "abcdefghij", - "some manner of key": "a type of value" - }, require_string("OK", name)); - - client.HMGET(key1, "0123456789", "some manner of key", function (err, reply) { - assert.strictEqual("abcdefghij", reply[0].toString(), name); - assert.strictEqual("a type of value", reply[1].toString(), name); - }); - - client.HMGET(key2, "0123456789", "some manner of key", function (err, reply) { - assert.strictEqual("abcdefghij", reply[0].toString(), name); - assert.strictEqual("a type of value", reply[1].toString(), name); - }); - - client.HMGET(key1, ["0123456789"], function (err, reply) { - assert.strictEqual("abcdefghij", reply[0], name); - }); - - client.HMGET(key1, ["0123456789", "some manner of key"], function (err, reply) { - assert.strictEqual("abcdefghij", reply[0], name); - assert.strictEqual("a type of value", reply[1], name); - }); - - client.HMGET(key1, "missing thing", "another missing thing", function (err, reply) { - assert.strictEqual(null, reply[0], name); - assert.strictEqual(null, reply[1], name); - next(name); - }); -}; - -tests.HINCRBY = function () { - var name = "HINCRBY"; - client.hset("hash incr", "value", 10, require_number(1, name)); - client.HINCRBY("hash incr", "value", 1, require_number(11, name)); - client.HINCRBY("hash incr", "value 2", 1, last(name, require_number(1, name))); -}; - -tests.SUBSCRIBE = function () { - var client1 = client, msg_count = 0, name = "SUBSCRIBE"; - - client1.on("subscribe", function (channel, count) { - if (channel === "chan1") { - client2.publish("chan1", "message 1", require_number(1, name)); - client2.publish("chan2", "message 2", require_number(1, name)); - client2.publish("chan1", "message 3", require_number(1, name)); - } - }); - - client1.on("unsubscribe", function (channel, count) { - if (count === 0) { - // make sure this connection can go into and out of pub/sub mode - client1.incr("did a thing", last(name, require_number(2, name))); - } - }); - - client1.on("message", function (channel, message) { - msg_count += 1; - assert.strictEqual("message " + msg_count, message.toString()); - if (msg_count === 3) { - client1.unsubscribe("chan1", "chan2"); - } - }); - - client1.set("did a thing", 1, require_string("OK", name)); - client1.subscribe("chan1", "chan2", function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual("chan1", results.toString(), name); - }); -}; - -tests.SUB_UNSUB_SUB = function () { - var name = "SUB_UNSUB_SUB"; - client3.subscribe('chan3'); - client3.unsubscribe('chan3'); - client3.subscribe('chan3', function (err, results) { - assert.strictEqual(null, err, "unexpected error: " + err); - client2.publish('chan3', 'foo'); - }); - client3.on('message', function (channel, message) { - assert.strictEqual(channel, 'chan3'); - assert.strictEqual(message, 'foo'); - next(name); - }); -}; - -tests.SUBSCRIBE_QUIT = function () { - var name = "SUBSCRIBE_QUIT"; - client3.on("end", function () { - next(name); - }); - client3.on("subscribe", function (channel, count) { - client3.quit(); - }); - client3.subscribe("chan3"); -}; - -tests.SUBSCRIBE_CLOSE_RESUBSCRIBE = function () { - var name = "SUBSCRIBE_CLOSE_RESUBSCRIBE"; - var c1 = redis.createClient(); - var c2 = redis.createClient(); - var count = 0; - - /* Create two clients. c1 subscribes to two channels, c2 will publish to them. - c2 publishes the first message. - c1 gets the message and drops its connection. It must resubscribe itself. - When it resubscribes, c2 publishes the second message, on the same channel - c1 gets the message and drops its connection. It must resubscribe itself, again. - When it resubscribes, c2 publishes the third message, on the second channel - c1 gets the message and drops its connection. When it reconnects, the test ends. - */ - - c1.on("message", function(channel, message) { - if (channel === "chan1") { - assert.strictEqual(message, "hi on channel 1"); - c1.stream.end(); - - } else if (channel === "chan2") { - assert.strictEqual(message, "hi on channel 2"); - c1.stream.end(); - - } else { - c1.quit(); - c2.quit(); - assert.fail("test failed"); - } - }) - - c1.subscribe("chan1", "chan2"); - - c2.once("ready", function() { - console.log("c2 is ready"); - c1.on("ready", function(err, results) { - console.log("c1 is ready", count); - - count++; - if (count == 1) { - c2.publish("chan1", "hi on channel 1"); - return; - - } else if (count == 2) { - c2.publish("chan2", "hi on channel 2"); - - } else { - c1.quit(function() { - c2.quit(function() { - next(name); - }); - }); - } - }); - - c2.publish("chan1", "hi on channel 1"); - - }); -}; - -tests.EXISTS = function () { - var name = "EXISTS"; - client.del("foo", "foo2", require_number_any(name)); - client.set("foo", "bar", require_string("OK", name)); - client.EXISTS("foo", require_number(1, name)); - client.EXISTS("foo2", last(name, require_number(0, name))); -}; - -tests.DEL = function () { - var name = "DEL"; - client.DEL("delkey", require_number_any(name)); - client.set("delkey", "delvalue", require_string("OK", name)); - client.DEL("delkey", require_number(1, name)); - client.exists("delkey", require_number(0, name)); - client.DEL("delkey", require_number(0, name)); - client.mset("delkey", "delvalue", "delkey2", "delvalue2", require_string("OK", name)); - client.DEL("delkey", "delkey2", last(name, require_number(2, name))); -}; - -tests.TYPE = function () { - var name = "TYPE"; - client.set(["string key", "should be a string"], require_string("OK", name)); - client.rpush(["list key", "should be a list"], require_number_pos(name)); - client.sadd(["set key", "should be a set"], require_number_any(name)); - client.zadd(["zset key", "10.0", "should be a zset"], require_number_any(name)); - client.hset(["hash key", "hashtest", "should be a hash"], require_number_any(0, name)); - - client.TYPE(["string key"], require_string("string", name)); - client.TYPE(["list key"], require_string("list", name)); - client.TYPE(["set key"], require_string("set", name)); - client.TYPE(["zset key"], require_string("zset", name)); - client.TYPE("not here yet", require_string("none", name)); - client.TYPE(["hash key"], last(name, require_string("hash", name))); -}; - -tests.KEYS = function () { - var name = "KEYS"; - client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name)); - client.KEYS(["test keys*"], function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(2, results.length, name); - assert.strictEqual("test keys 1", results[0].toString(), name); - assert.strictEqual("test keys 2", results[1].toString(), name); - next(name); - }); -}; - -tests.MULTIBULK_ZERO_LENGTH = function () { - var name = "MULTIBULK_ZERO_LENGTH"; - client.KEYS(['users:*'], function (err, results) { - assert.strictEqual(null, err, 'error on empty multibulk reply'); - assert.strictEqual(true, is_empty_array(results), "not an empty array"); - next(name); - }); -}; - -tests.RANDOMKEY = function () { - var name = "RANDOMKEY"; - client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name)); - client.RANDOMKEY([], function (err, results) { - assert.strictEqual(null, err, name + " result sent back unexpected error: " + err); - assert.strictEqual(true, /\w+/.test(results), name); - next(name); - }); -}; - -tests.RENAME = function () { - var name = "RENAME"; - client.set(['foo', 'bar'], require_string("OK", name)); - client.RENAME(["foo", "new foo"], require_string("OK", name)); - client.exists(["foo"], require_number(0, name)); - client.exists(["new foo"], last(name, require_number(1, name))); -}; - -tests.RENAMENX = function () { - var name = "RENAMENX"; - client.set(['foo', 'bar'], require_string("OK", name)); - client.set(['foo2', 'bar2'], require_string("OK", name)); - client.RENAMENX(["foo", "foo2"], require_number(0, name)); - client.exists(["foo"], require_number(1, name)); - client.exists(["foo2"], require_number(1, name)); - client.del(["foo2"], require_number(1, name)); - client.RENAMENX(["foo", "foo2"], require_number(1, name)); - client.exists(["foo"], require_number(0, name)); - client.exists(["foo2"], last(name, require_number(1, name))); -}; - -tests.DBSIZE = function () { - var name = "DBSIZE"; - client.set(['foo', 'bar'], require_string("OK", name)); - client.DBSIZE([], last(name, require_number_pos("DBSIZE"))); -}; - -tests.GET = function () { - var name = "GET"; - client.set(["get key", "get val"], require_string("OK", name)); - client.GET(["get key"], last(name, require_string("get val", name))); -}; - -tests.SET = function () { - var name = "SET"; - client.SET(["set key", "set val"], require_string("OK", name)); - client.get(["set key"], last(name, require_string("set val", name))); -}; - -tests.GETSET = function () { - var name = "GETSET"; - client.set(["getset key", "getset val"], require_string("OK", name)); - client.GETSET(["getset key", "new getset val"], require_string("getset val", name)); - client.get(["getset key"], last(name, require_string("new getset val", name))); -}; - -tests.MGET = function () { - var name = "MGET"; - client.mset(["mget keys 1", "mget val 1", "mget keys 2", "mget val 2", "mget keys 3", "mget val 3"], require_string("OK", name)); - client.MGET("mget keys 1", "mget keys 2", "mget keys 3", function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(3, results.length, name); - assert.strictEqual("mget val 1", results[0].toString(), name); - assert.strictEqual("mget val 2", results[1].toString(), name); - assert.strictEqual("mget val 3", results[2].toString(), name); - }); - client.MGET(["mget keys 1", "mget keys 2", "mget keys 3"], function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(3, results.length, name); - assert.strictEqual("mget val 1", results[0].toString(), name); - assert.strictEqual("mget val 2", results[1].toString(), name); - assert.strictEqual("mget val 3", results[2].toString(), name); - }); - client.MGET(["mget keys 1", "some random shit", "mget keys 2", "mget keys 3"], function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(4, results.length, name); - assert.strictEqual("mget val 1", results[0].toString(), name); - assert.strictEqual(null, results[1], name); - assert.strictEqual("mget val 2", results[2].toString(), name); - assert.strictEqual("mget val 3", results[3].toString(), name); - next(name); - }); -}; - -tests.SETNX = function () { - var name = "SETNX"; - client.set(["setnx key", "setnx value"], require_string("OK", name)); - client.SETNX(["setnx key", "new setnx value"], require_number(0, name)); - client.del(["setnx key"], require_number(1, name)); - client.exists(["setnx key"], require_number(0, name)); - client.SETNX(["setnx key", "new setnx value"], require_number(1, name)); - client.exists(["setnx key"], last(name, require_number(1, name))); -}; - -tests.SETEX = function () { - var name = "SETEX"; - client.SETEX(["setex key", "100", "setex val"], require_string("OK", name)); - client.exists(["setex key"], require_number(1, name)); - client.ttl(["setex key"], last(name, require_number_pos(name))); -}; - -tests.MSETNX = function () { - var name = "MSETNX"; - client.mset(["mset1", "val1", "mset2", "val2", "mset3", "val3"], require_string("OK", name)); - client.MSETNX(["mset3", "val3", "mset4", "val4"], require_number(0, name)); - client.del(["mset3"], require_number(1, name)); - client.MSETNX(["mset3", "val3", "mset4", "val4"], require_number(1, name)); - client.exists(["mset3"], require_number(1, name)); - client.exists(["mset4"], last(name, require_number(1, name))); -}; - -tests.HGETALL = function () { - var name = "HGETALL"; - client.hmset(["hosts", "mjr", "1", "another", "23", "home", "1234"], require_string("OK", name)); - client.HGETALL(["hosts"], function (err, obj) { - assert.strictEqual(null, err, name + " result sent back unexpected error: " + err); - assert.strictEqual(3, Object.keys(obj).length, name); - assert.strictEqual("1", obj.mjr.toString(), name); - assert.strictEqual("23", obj.another.toString(), name); - assert.strictEqual("1234", obj.home.toString(), name); - next(name); - }); -}; - -tests.HGETALL_NULL = function () { - var name = "HGETALL_NULL"; - - client.hgetall("missing", function (err, obj) { - assert.strictEqual(null, err); - assert.strictEqual(null, obj); - next(name); - }); -}; - -tests.UTF8 = function () { - var name = "UTF8", - utf8_sample = "ಠ_ಠ"; - - client.set(["utf8test", utf8_sample], require_string("OK", name)); - client.get(["utf8test"], function (err, obj) { - assert.strictEqual(null, err); - assert.strictEqual(utf8_sample, obj); - next(name); - }); -}; - -// Set tests were adapted from Brian Hammond's redis-node-client.js, which has a comprehensive test suite - -tests.SADD = function () { - var name = "SADD"; - - client.del('set0'); - client.SADD('set0', 'member0', require_number(1, name)); - client.sadd('set0', 'member0', last(name, require_number(0, name))); -}; - -tests.SADD2 = function () { - var name = "SADD2"; - - client.del("set0"); - client.sadd("set0", ["member0", "member1", "member2"], require_number(3, name)); - client.smembers("set0", function (err, res) { - assert.strictEqual(res.length, 3); - assert.strictEqual(res[0], "member0"); - assert.strictEqual(res[1], "member1"); - assert.strictEqual(res[2], "member2"); - }); - client.SADD("set1", ["member0", "member1", "member2"], require_number(3, name)); - client.smembers("set1", function (err, res) { - assert.strictEqual(res.length, 3); - assert.strictEqual(res[0], "member0"); - assert.strictEqual(res[1], "member1"); - assert.strictEqual(res[2], "member2"); - next(name); - }); -}; - -tests.SISMEMBER = function () { - var name = "SISMEMBER"; - - client.del('set0'); - client.sadd('set0', 'member0', require_number(1, name)); - client.sismember('set0', 'member0', require_number(1, name)); - client.sismember('set0', 'member1', last(name, require_number(0, name))); -}; - -tests.SCARD = function () { - var name = "SCARD"; - - client.del('set0'); - client.sadd('set0', 'member0', require_number(1, name)); - client.scard('set0', require_number(1, name)); - client.sadd('set0', 'member1', require_number(1, name)); - client.scard('set0', last(name, require_number(2, name))); -}; - -tests.SREM = function () { - var name = "SREM"; - - client.del('set0'); - client.sadd('set0', 'member0', require_number(1, name)); - client.srem('set0', 'foobar', require_number(0, name)); - client.srem('set0', 'member0', require_number(1, name)); - client.scard('set0', last(name, require_number(0, name))); -}; - -tests.SPOP = function () { - var name = "SPOP"; - - client.del('zzz'); - client.sadd('zzz', 'member0', require_number(1, name)); - client.scard('zzz', require_number(1, name)); - - client.spop('zzz', function (err, value) { - if (err) { - assert.fail(err); - } - assert.equal(value, 'member0', name); - }); - - client.scard('zzz', last(name, require_number(0, name))); -}; - -tests.SDIFF = function () { - var name = "SDIFF"; - - client.del('foo'); - client.sadd('foo', 'x', require_number(1, name)); - client.sadd('foo', 'a', require_number(1, name)); - client.sadd('foo', 'b', require_number(1, name)); - client.sadd('foo', 'c', require_number(1, name)); - - client.sadd('bar', 'c', require_number(1, name)); - - client.sadd('baz', 'a', require_number(1, name)); - client.sadd('baz', 'd', require_number(1, name)); - - client.sdiff('foo', 'bar', 'baz', function (err, values) { - if (err) { - assert.fail(err, name); - } - values.sort(); - assert.equal(values.length, 2, name); - assert.equal(values[0], 'b', name); - assert.equal(values[1], 'x', name); - next(name); - }); -}; - -tests.SDIFFSTORE = function () { - var name = "SDIFFSTORE"; - - client.del('foo'); - client.del('bar'); - client.del('baz'); - client.del('quux'); - - client.sadd('foo', 'x', require_number(1, name)); - client.sadd('foo', 'a', require_number(1, name)); - client.sadd('foo', 'b', require_number(1, name)); - client.sadd('foo', 'c', require_number(1, name)); - - client.sadd('bar', 'c', require_number(1, name)); - - client.sadd('baz', 'a', require_number(1, name)); - client.sadd('baz', 'd', require_number(1, name)); - - // NB: SDIFFSTORE returns the number of elements in the dstkey - - client.sdiffstore('quux', 'foo', 'bar', 'baz', require_number(2, name)); - - client.smembers('quux', function (err, values) { - if (err) { - assert.fail(err, name); - } - var members = buffers_to_strings(values).sort(); - - assert.deepEqual(members, [ 'b', 'x' ], name); - next(name); - }); -}; - -tests.SMEMBERS = function () { - var name = "SMEMBERS"; - - client.del('foo'); - client.sadd('foo', 'x', require_number(1, name)); - - client.smembers('foo', function (err, members) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(members), [ 'x' ], name); - }); - - client.sadd('foo', 'y', require_number(1, name)); - - client.smembers('foo', function (err, values) { - if (err) { - assert.fail(err, name); - } - assert.equal(values.length, 2, name); - var members = buffers_to_strings(values).sort(); - - assert.deepEqual(members, [ 'x', 'y' ], name); - next(name); - }); -}; - -tests.SMOVE = function () { - var name = "SMOVE"; - - client.del('foo'); - client.del('bar'); - - client.sadd('foo', 'x', require_number(1, name)); - client.smove('foo', 'bar', 'x', require_number(1, name)); - client.sismember('foo', 'x', require_number(0, name)); - client.sismember('bar', 'x', require_number(1, name)); - client.smove('foo', 'bar', 'x', last(name, require_number(0, name))); -}; - -tests.SINTER = function () { - var name = "SINTER"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sinter('sa', 'sb', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 2, name); - assert.deepEqual(buffers_to_strings(intersection).sort(), [ 'b', 'c' ], name); - }); - - client.sinter('sb', 'sc', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 2, name); - assert.deepEqual(buffers_to_strings(intersection).sort(), [ 'c', 'd' ], name); - }); - - client.sinter('sa', 'sc', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 1, name); - assert.equal(intersection[0], 'c', name); - }); - - // 3-way - - client.sinter('sa', 'sb', 'sc', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 1, name); - assert.equal(intersection[0], 'c', name); - next(name); - }); -}; - -tests.SINTERSTORE = function () { - var name = "SINTERSTORE"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - client.del('foo'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sinterstore('foo', 'sa', 'sb', 'sc', require_number(1, name)); - - client.smembers('foo', function (err, members) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(members), [ 'c' ], name); - next(name); - }); -}; - -tests.SUNION = function () { - var name = "SUNION"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sunion('sa', 'sb', 'sc', function (err, union) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(union).sort(), ['a', 'b', 'c', 'd', 'e'], name); - next(name); - }); -}; - -tests.SUNIONSTORE = function () { - var name = "SUNIONSTORE"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - client.del('foo'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sunionstore('foo', 'sa', 'sb', 'sc', function (err, cardinality) { - if (err) { - assert.fail(err, name); - } - assert.equal(cardinality, 5, name); - }); - - client.smembers('foo', function (err, members) { - if (err) { - assert.fail(err, name); - } - assert.equal(members.length, 5, name); - assert.deepEqual(buffers_to_strings(members).sort(), ['a', 'b', 'c', 'd', 'e'], name); - next(name); - }); -}; - -// SORT test adapted from Brian Hammond's redis-node-client.js, which has a comprehensive test suite - -tests.SORT = function () { - var name = "SORT"; - - client.del('y'); - client.del('x'); - - client.rpush('y', 'd', require_number(1, name)); - client.rpush('y', 'b', require_number(2, name)); - client.rpush('y', 'a', require_number(3, name)); - client.rpush('y', 'c', require_number(4, name)); - - client.rpush('x', '3', require_number(1, name)); - client.rpush('x', '9', require_number(2, name)); - client.rpush('x', '2', require_number(3, name)); - client.rpush('x', '4', require_number(4, name)); - - client.set('w3', '4', require_string("OK", name)); - client.set('w9', '5', require_string("OK", name)); - client.set('w2', '12', require_string("OK", name)); - client.set('w4', '6', require_string("OK", name)); - - client.set('o2', 'buz', require_string("OK", name)); - client.set('o3', 'foo', require_string("OK", name)); - client.set('o4', 'baz', require_string("OK", name)); - client.set('o9', 'bar', require_string("OK", name)); - - client.set('p2', 'qux', require_string("OK", name)); - client.set('p3', 'bux', require_string("OK", name)); - client.set('p4', 'lux', require_string("OK", name)); - client.set('p9', 'tux', require_string("OK", name)); - - // Now the data has been setup, we can test. - - // But first, test basic sorting. - - // y = [ d b a c ] - // sort y ascending = [ a b c d ] - // sort y descending = [ d c b a ] - - client.sort('y', 'asc', 'alpha', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['a', 'b', 'c', 'd'], name); - }); - - client.sort('y', 'desc', 'alpha', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['d', 'c', 'b', 'a'], name); - }); - - // Now try sorting numbers in a list. - // x = [ 3, 9, 2, 4 ] - - client.sort('x', 'asc', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), [2, 3, 4, 9], name); - }); - - client.sort('x', 'desc', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), [9, 4, 3, 2], name); - }); - - // Try sorting with a 'by' pattern. - - client.sort('x', 'by', 'w*', 'asc', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), [3, 9, 4, 2], name); - }); - - // Try sorting with a 'by' pattern and 1 'get' pattern. - - client.sort('x', 'by', 'w*', 'asc', 'get', 'o*', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['foo', 'bar', 'baz', 'buz'], name); - }); - - // Try sorting with a 'by' pattern and 2 'get' patterns. - - client.sort('x', 'by', 'w*', 'asc', 'get', 'o*', 'get', 'p*', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['foo', 'bux', 'bar', 'tux', 'baz', 'lux', 'buz', 'qux'], name); - }); - - // Try sorting with a 'by' pattern and 2 'get' patterns. - // Instead of getting back the sorted set/list, store the values to a list. - // Then check that the values are there in the expected order. - - client.sort('x', 'by', 'w*', 'asc', 'get', 'o*', 'get', 'p*', 'store', 'bacon', function (err) { - if (err) { - assert.fail(err, name); - } - }); - - client.lrange('bacon', 0, -1, function (err, values) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(values), ['foo', 'bux', 'bar', 'tux', 'baz', 'lux', 'buz', 'qux'], name); - next(name); - }); - - // TODO - sort by hash value -}; - -tests.MONITOR = function () { - var name = "MONITOR", responses = [], monitor_client; - - monitor_client = redis.createClient(); - monitor_client.monitor(function (err, res) { - client.mget("some", "keys", "foo", "bar"); - client.set("json", JSON.stringify({ - foo: "123", - bar: "sdflkdfsjk", - another: false - })); - }); - monitor_client.on("monitor", function (time, args) { - // skip monitor command for Redis <= 2.4.16 - if (args[0] === "monitor") return; - - responses.push(args); - if (responses.length === 2) { - assert.strictEqual(5, responses[0].length); - assert.strictEqual("mget", responses[0][0]); - assert.strictEqual("some", responses[0][1]); - assert.strictEqual("keys", responses[0][2]); - assert.strictEqual("foo", responses[0][3]); - assert.strictEqual("bar", responses[0][4]); - assert.strictEqual(3, responses[1].length); - assert.strictEqual("set", responses[1][0]); - assert.strictEqual("json", responses[1][1]); - assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]); - monitor_client.quit(function (err, res) { - next(name); - }); - } - }); -}; - -tests.BLPOP = function () { - var name = "BLPOP"; - - client.rpush("blocking list", "initial value", function (err, res) { - client2.BLPOP("blocking list", 0, function (err, res) { - assert.strictEqual("blocking list", res[0].toString()); - assert.strictEqual("initial value", res[1].toString()); - - client.rpush("blocking list", "wait for this value"); - }); - client2.BLPOP("blocking list", 0, function (err, res) { - assert.strictEqual("blocking list", res[0].toString()); - assert.strictEqual("wait for this value", res[1].toString()); - next(name); - }); - }); -}; - -tests.BLPOP_TIMEOUT = function () { - var name = "BLPOP_TIMEOUT"; - - // try to BLPOP the list again, which should be empty. This should timeout and return null. - client2.BLPOP("blocking list", 1, function (err, res) { - if (err) { - throw err; - } - - assert.strictEqual(res, null); - next(name); - }); -}; - -tests.EXPIRE = function () { - var name = "EXPIRE"; - client.set(['expiry key', 'bar'], require_string("OK", name)); - client.EXPIRE(["expiry key", "1"], require_number_pos(name)); - setTimeout(function () { - client.exists(["expiry key"], last(name, require_number(0, name))); - }, 2000); -}; - -tests.TTL = function () { - var name = "TTL"; - client.set(["ttl key", "ttl val"], require_string("OK", name)); - client.expire(["ttl key", "100"], require_number_pos(name)); - setTimeout(function () { - client.TTL(["ttl key"], last(name, require_number_pos(0, name))); - }, 500); -}; - -tests.OPTIONAL_CALLBACK = function () { - var name = "OPTIONAL_CALLBACK"; - client.del("op_cb1"); - client.set("op_cb1", "x"); - client.get("op_cb1", last(name, require_string("x", name))); -}; - -tests.OPTIONAL_CALLBACK_UNDEFINED = function () { - var name = "OPTIONAL_CALLBACK_UNDEFINED"; - client.del("op_cb2"); - client.set("op_cb2", "y", undefined); - client.get("op_cb2", last(name, require_string("y", name))); -}; - -tests.HMSET_THROWS_ON_NON_STRINGS = function () { - var name = "HMSET_THROWS_ON_NON_STRINGS"; - var hash = name; - var data = { "a": [ "this is not a string" ] }; - - client.hmset(hash, data, cb); - function cb(e, r) { - assert(e); // should be an error! - } - - // alternative way it throws - function thrower() { - client.hmset(hash, data); - } - assert.throws(thrower); - next(name); -}; - -tests.ENABLE_OFFLINE_QUEUE_TRUE = function () { - var name = "ENABLE_OFFLINE_QUEUE_TRUE"; - var cli = redis.createClient(9999, null, { - max_attempts: 1 - // default :) - // enable_offline_queue: true - }); - cli.on('error', function(e) { - // ignore, b/c expecting a "can't connect" error - }); - return setTimeout(function() { - cli.set(name, name, function(err, result) { - assert.ifError(err); - }); - - return setTimeout(function(){ - assert.strictEqual(cli.offline_queue.length, 1); - return next(name); - }, 25); - }, 50); -}; - -tests.ENABLE_OFFLINE_QUEUE_FALSE = function () { - var name = "ENABLE_OFFLINE_QUEUE_FALSE"; - var cli = redis.createClient(9999, null, { - max_attempts: 1, - enable_offline_queue: false - }); - cli.on('error', function() { - // ignore, see above - }); - assert.throws(function () { - cli.set(name, name) - }) - assert.doesNotThrow(function () { - cli.set(name, name, function (err) { - // should callback with an error - assert.ok(err); - setTimeout(function () { - next(name); - }, 50); - }); - }); -}; - -// TODO - need a better way to test auth, maybe auto-config a local Redis server or something. -// Yes, this is the real password. Please be nice, thanks. -tests.auth = function () { - var name = "AUTH", client4, ready_count = 0; - - client4 = redis.createClient(9006, "filefish.redistogo.com"); - client4.auth("664b1b6aaf134e1ec281945a8de702a9", function (err, res) { - assert.strictEqual(null, err, name); - assert.strictEqual("OK", res.toString(), name); - }); - - // test auth, then kill the connection so it'll auto-reconnect and auto-re-auth - client4.on("ready", function () { - ready_count++; - if (ready_count === 1) { - client4.stream.destroy(); - } else { - client4.quit(function (err, res) { - next(name); - }); - } - }); -}; - -all_tests = Object.keys(tests); -all_start = new Date(); -test_count = 0; - -run_next_test = function run_next_test() { - var test_name = all_tests.shift(); - if (typeof tests[test_name] === "function") { - util.print('- \x1b[1m' + test_name.toLowerCase() + '\x1b[0m:'); - cur_start = new Date(); - test_count += 1; - tests[test_name](); - } else { - console.log('\n completed \x1b[32m%d\x1b[0m tests in \x1b[33m%d\x1b[0m ms\n', test_count, new Date() - all_start); - client.quit(); - client2.quit(); - } -}; - -client.once("ready", function start_tests() { - console.log("Connected to " + client.host + ":" + client.port + ", Redis server version " + client.server_info.redis_version + "\n"); - console.log("Using reply parser " + client.reply_parser.name); - - run_next_test(); - - connected = true; -}); - -client.on('end', function () { - ended = true; -}); - -// Exit immediately on connection failure, which triggers "exit", below, which fails the test -client.on("error", function (err) { - console.error("client: " + err.stack); - process.exit(); -}); -client2.on("error", function (err) { - console.error("client2: " + err.stack); - process.exit(); -}); -client3.on("error", function (err) { - console.error("client3: " + err.stack); - process.exit(); -}); -client.on("reconnecting", function (params) { - console.log("reconnecting: " + util.inspect(params)); -}); - -process.on('uncaughtException', function (err) { - console.error("Uncaught exception: " + err.stack); - process.exit(1); -}); - -process.on('exit', function (code) { - assert.equal(true, connected); - assert.equal(true, ended); -}); diff --git a/realtime/node_modules/socket.io/.npmignore b/realtime/node_modules/socket.io/.npmignore deleted file mode 100644 index 39e9864f..00000000 --- a/realtime/node_modules/socket.io/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -support -test -examples diff --git a/realtime/node_modules/socket.io/.travis.yml b/realtime/node_modules/socket.io/.travis.yml deleted file mode 100644 index 56eca033..00000000 --- a/realtime/node_modules/socket.io/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - 0.6 - -notifications: - irc: "irc.freenode.org#socket.io" diff --git a/realtime/node_modules/socket.io/History.md b/realtime/node_modules/socket.io/History.md deleted file mode 100644 index c1ee4122..00000000 --- a/realtime/node_modules/socket.io/History.md +++ /dev/null @@ -1,305 +0,0 @@ - -0.9.12 / 2012-12-13 -=================== - - * manager: fix for latest node which is returning a clone with `listeners` [viirya] - -0.9.11 / 2012-11-02 -=================== - - * package: move redis to optionalDependenices [3rd-Eden] - * bumped client - -0.9.10 / 2012-08-10 -=================== - - * Don't lowercase log messages - * Always set the HTTP response in case an error should be returned to the client - * Create or destroy the flash policy server on configuration change - * Honour configuration to disable flash policy server - * Add express 3.0 instructions on Readme.md - * Bump client - -0.9.9 / 2012-08-01 -================== - - * Fixed sync disconnect xhrs handling - * Put license text in its own file (#965) - * Add warning to .listen() to ease the migration to Express 3.x - * Restored compatibility with node 0.4.x - -0.9.8 / 2012-07-24 -================== - - * Bumped client. - -0.9.7 / 2012-07-24 -================== - - * Prevent crash when socket leaves a room twice. - * Corrects unsafe usage of for..in - * Fix for node 0.8 with `gzip compression` [vadimi] - * Update redis to support Node 0.8.x - * Made ID generation securely random - * Fix Redis Store race condition in manager onOpen unsubscribe callback - * Fix for EventEmitters always reusing the same Array instance for listeners - -0.9.6 / 2012-04-17 -================== - - * Fixed XSS in jsonp-polling. - -0.9.5 / 2012-04-05 -================== - - * Added test for polling and socket close. - * Ensure close upon request close. - * Fix disconnection reason being lost for polling transports. - * Ensure that polling transports work with Connection: close. - * Log disconnection reason. - -0.9.4 / 2012-04-01 -================== - - * Disconnecting from namespace improvement (#795) [DanielBaulig] - * Bumped client with polling reconnection loop (#438) - -0.9.3 / 2012-03-28 -================== - - * Fix "Syntax error" on FF Web Console with XHR Polling [mikito] - -0.9.2 / 2012-03-13 -================== - - * More sensible close `timeout default` (fixes disconnect issue) - -0.9.1-1 / 2012-03-02 -==================== - - * Bumped client with NPM dependency fix. - -0.9.1 / 2012-03-02 -================== - - * Changed heartbeat timeout and interval defaults (60 and 25 seconds) - * Make tests work both on 0.4 and 0.6 - * Updated client (improvements + bug fixes). - -0.9.0 / 2012-02-26 -================== - - * Make it possible to use a regexp to match the socket.io resource URL. - We need this because we have to prefix the socket.io URL with a variable ID. - * Supplemental fix to gavinuhma/authfix, it looks like the same Access-Control-Origin logic is needed in the http and xhr-polling transports - * Updated express dep for windows compatibility. - * Combine two substr calls into one in decodePayload to improve performance - * Minor documentation fix - * Minor. Conform to style of other files. - * Switching setting to 'match origin protocol' - * Revert "Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect()." - * Revert "Handle leaked dispatch:[id] subscription." - * Merge pull request #667 from dshaw/patch/redis-disconnect - * Handle leaked dispatch:[id] subscription. - * Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect(). - * Prevent memory leaking on uncompleted requests & add max post size limitation - * Fix for testcase - * Set Access-Control-Allow-Credentials true, regardless of cookie - * Remove assertvarnish from package as it breaks on 0.6 - * Correct irc channel - * Added proper return after reserved field error - * Fixes manager.js failure to close connection after transport error has happened - * Added implicit port 80 for origin checks. fixes #638 - * Fixed bug #432 in 0.8.7 - * Set Access-Control-Allow-Origin header to origin to enable withCredentials - * Adding configuration variable matchOriginProtocol - * Fixes location mismatch error in Safari. - * Use tty to detect if we should add colors or not by default. - * Updated the package location. - -0.8.7 / 2011-11-05 -================== - - * Fixed memory leaks in closed clients. - * Fixed memory leaks in namespaces. - * Fixed websocket handling for malformed requests from proxies. [einaros] - * Node 0.6 compatibility. [einaros] [3rd-Eden] - * Adapted tests and examples. - -0.8.6 / 2011-10-27 -================== - - * Added JSON decoding on jsonp-polling transport. - * Fixed README example. - * Major speed optimizations [3rd-Eden] [einaros] [visionmedia] - * Added decode/encode benchmarks [visionmedia] - * Added support for black-listing client sent events. - * Fixed logging options, closes #540 [3rd-Eden] - * Added vary header for gzip [3rd-Eden] - * Properly cleaned up async websocket / flashsocket tests, after patching node-websocket-client - * Patched to properly shut down when a finishClose call is made during connection establishment - * Added support for socket.io version on url and far-future Expires [3rd-Eden] [getify] - * Began IE10 compatibility [einaros] [tbranyen] - * Misc WebSocket fixes [einaros] - * Added UTF8 to respone headers for htmlfile [3rd-Eden] - -0.8.5 / 2011-10-07 -================== - - * Added websocket draft HyBi-16 support. [einaros] - * Fixed websocket continuation bugs. [einaros] - * Fixed flashsocket transport name. - * Fixed websocket tests. - * Ensured `parser#decodePayload` doesn't choke. - * Added http referrer verification to manager verifyOrigin. - * Added access control for cross domain xhr handshakes [3rd-Eden] - * Added support for automatic generation of socket.io files [3rd-Eden] - * Added websocket binary support [einaros] - * Added gzip support for socket.io.js [3rd-Eden] - * Expose socket.transport [3rd-Eden] - * Updated client. - -0.8.4 / 2011-09-06 -================== - - * Client build - -0.8.3 / 2011-09-03 -================== - - * Fixed `\n` parsing for non-JSON packets (fixes #479). - * Fixed parsing of certain unicode characters (fixes #451). - * Fixed transport message packet logging. - * Fixed emission of `error` event resulting in an uncaught exception if unhandled (fixes #476). - * Fixed; allow for falsy values as the configuration value of `log level` (fixes #491). - * Fixed repository URI in `package.json`. Fixes #504. - * Added text/plain content-type to handshake responses [einaros] - * Improved single byte writes [einaros] - * Updated socket.io-flashsocket default port from 843 to 10843 [3rd-Eden] - * Updated client. - -0.8.2 / 2011-08-29 -================== - - * Updated client. - -0.8.1 / 2011-08-29 -================== - - * Fixed utf8 bug in send framing in websocket [einaros] - * Fixed typo in docs [Znarkus] - * Fixed bug in send framing for over 64kB of data in websocket [einaros] - * Corrected ping handling in websocket transport [einaros] - -0.8.0 / 2011-08-28 -================== - - * Updated to work with two-level websocket versioning. [einaros] - * Added hybi07 support. [einaros] - * Added hybi10 support. [einaros] - * Added http referrer verification to manager.js verifyOrigin. [einaors] - -0.7.11 / 2011-08-27 -=================== - - * Updated socket.io-client. - -0.7.10 / 2011-08-27 -=================== - - * Updated socket.io-client. - -0.7.9 / 2011-08-12 -================== - - * Updated socket.io-client. - * Make sure we only do garbage collection when the server we receive is actually run. - -0.7.8 / 2011-08-08 -================== - - * Changed; make sure sio#listen passes options to both HTTP server and socket.io manager. - * Added docs for sio#listen. - * Added options parameter support for Manager constructor. - * Added memory leaks tests and test-leaks Makefile task. - * Removed auto npm-linking from make test. - * Make sure that you can disable heartbeats. [3rd-Eden] - * Fixed rooms memory leak [3rd-Eden] - * Send response once we got all POST data, not immediately [Pita] - * Fixed onLeave behavior with missing clientsk [3rd-Eden] - * Prevent duplicate references in rooms. - * Added alias for `to` to `in` and `in` to `to`. - * Fixed roomClients definition. - * Removed dependency on redis for installation without npm [3rd-Eden] - * Expose path and querystring in handshakeData [3rd-Eden] - -0.7.7 / 2011-07-12 -================== - - * Fixed double dispatch handling with emit to closed clients. - * Added test for emitting to closed clients to prevent regression. - * Fixed race condition in redis test. - * Changed Transport#end instrumentation. - * Leveraged $emit instead of emit internally. - * Made tests faster. - * Fixed double disconnect events. - * Fixed disconnect logic - * Simplified remote events handling in Socket. - * Increased testcase timeout. - * Fixed unknown room emitting (GH-291). [3rd-Eden] - * Fixed `address` in handshakeData. [3rd-Eden] - * Removed transports definition in chat example. - * Fixed room cleanup - * Fixed; make sure the client is cleaned up after booting. - * Make sure to mark the client as non-open if the connection is closed. - * Removed unneeded `buffer` declarations. - * Fixed; make sure to clear socket handlers and subscriptions upon transport close. - -0.7.6 / 2011-06-30 -================== - - * Fixed general dispatching when a client has closed. - -0.7.5 / 2011-06-30 -================== - - * Fixed dispatching to clients that are disconnected. - -0.7.4 / 2011-06-30 -================== - - * Fixed; only clear handlers if they were set. [level09] - -0.7.3 / 2011-06-30 -================== - - * Exposed handshake data to clients. - * Refactored dispatcher interface. - * Changed; Moved id generation method into the manager. - * Added sub-namespace authorization. [3rd-Eden] - * Changed; normalized SocketNamespace local eventing [dvv] - * Changed; Use packet.reason or default to 'packet' [3rd-Eden] - * Changed console.error to console.log. - * Fixed; bind both servers at the same time do that the test never times out. - * Added 304 support. - * Removed `Transport#name` for abstract interface. - * Changed; lazily require http and https module only when needed. [3rd-Eden] - -0.7.2 / 2011-06-22 -================== - - * Make sure to write a packet (of type `noop`) when closing a poll. - This solves a problem with cross-domain requests being flagged as aborted and - reconnection being triggered. - * Added `noop` message type. - -0.7.1 / 2011-06-21 -================== - - * Fixed cross-domain XHR. - * Added CORS test to xhr-polling suite. - -0.7.0 / 2010-06-21 -================== - - * http://socket.io/announcement.html diff --git a/realtime/node_modules/socket.io/LICENSE b/realtime/node_modules/socket.io/LICENSE deleted file mode 100644 index 0f4acd44..00000000 --- a/realtime/node_modules/socket.io/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 Guillermo Rauch - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/socket.io/Makefile b/realtime/node_modules/socket.io/Makefile deleted file mode 100644 index 832cba8b..00000000 --- a/realtime/node_modules/socket.io/Makefile +++ /dev/null @@ -1,31 +0,0 @@ - -ALL_TESTS = $(shell find test/ -name '*.test.js') -ALL_BENCH = $(shell find benchmarks -name '*.bench.js') - -run-tests: - @./node_modules/.bin/expresso \ - -t 3000 \ - -I support \ - --serial \ - $(TESTFLAGS) \ - $(TESTS) - -test: - @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests - -test-cov: - @TESTFLAGS=--cov $(MAKE) test - -test-leaks: - @ls test/leaks/* | xargs node --expose_debug_as=debug --expose_gc - -run-bench: - @node $(PROFILEFLAGS) benchmarks/runner.js - -bench: - @$(MAKE) BENCHMARKS="$(ALL_BENCH)" run-bench - -profile: - @PROFILEFLAGS='--prof --trace-opt --trace-bailout --trace-deopt' $(MAKE) bench - -.PHONY: test bench profile diff --git a/realtime/node_modules/socket.io/Readme.md b/realtime/node_modules/socket.io/Readme.md deleted file mode 100644 index 41f21f68..00000000 --- a/realtime/node_modules/socket.io/Readme.md +++ /dev/null @@ -1,364 +0,0 @@ -# Socket.IO - -Socket.IO is a Node.JS project that makes WebSockets and realtime possible in -all browsers. It also enhances WebSockets by providing built-in multiplexing, -horizontal scalability, automatic JSON encoding/decoding, and more. - -## How to Install - -```bash -npm install socket.io -``` - -## How to use - -First, require `socket.io`: - -```js -var io = require('socket.io'); -``` - -Next, attach it to a HTTP/HTTPS server. If you're using the fantastic `express` -web framework: - -#### Express 3.x - -```js -var app = express() - , server = require('http').createServer(app) - , io = io.listen(server); - -server.listen(80); - -io.sockets.on('connection', function (socket) { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', function (data) { - console.log(data); - }); -}); -``` - -#### Express 2.x - -```js -var app = express.createServer() - , io = io.listen(app); - -app.listen(80); - -io.sockets.on('connection', function (socket) { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', function (data) { - console.log(data); - }); -}); -``` - -Finally, load it from the client side code: - -```html - - -``` - -For more thorough examples, look at the `examples/` directory. - -## Short recipes - -### Sending and receiving events. - -Socket.IO allows you to emit and receive custom events. -Besides `connect`, `message` and `disconnect`, you can emit custom events: - -```js -// note, io.listen() will create a http server for you -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - io.sockets.emit('this', { will: 'be received by everyone' }); - - socket.on('private message', function (from, msg) { - console.log('I received a private message by ', from, ' saying ', msg); - }); - - socket.on('disconnect', function () { - io.sockets.emit('user disconnected'); - }); -}); -``` - -### Storing data associated to a client - -Sometimes it's necessary to store data associated with a client that's -necessary for the duration of the session. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.on('set nickname', function (name) { - socket.set('nickname', name, function () { socket.emit('ready'); }); - }); - - socket.on('msg', function () { - socket.get('nickname', function (err, name) { - console.log('Chat message by ', name); - }); - }); -}); -``` - -#### Client side - -```html - -``` - -### Restricting yourself to a namespace - -If you have control over all the messages and events emitted for a particular -application, using the default `/` namespace works. - -If you want to leverage 3rd-party code, or produce code to share with others, -socket.io provides a way of namespacing a `socket`. - -This has the benefit of `multiplexing` a single connection. Instead of -socket.io using two `WebSocket` connections, it'll use one. - -The following example defines a socket that listens on '/chat' and one for -'/news': - -#### Server side - -```js -var io = require('socket.io').listen(80); - -var chat = io - .of('/chat') - .on('connection', function (socket) { - socket.emit('a message', { that: 'only', '/chat': 'will get' }); - chat.emit('a message', { everyone: 'in', '/chat': 'will get' }); - }); - -var news = io - .of('/news'); - .on('connection', function (socket) { - socket.emit('item', { news: 'item' }); - }); -``` - -#### Client side: - -```html - -``` - -### Sending volatile messages. - -Sometimes certain messages can be dropped. Let's say you have an app that -shows realtime tweets for the keyword `bieber`. - -If a certain client is not ready to receive messages (because of network slowness -or other issues, or because he's connected through long polling and is in the -middle of a request-response cycle), if he doesn't receive ALL the tweets related -to bieber your application won't suffer. - -In that case, you might want to send those messages as volatile messages. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - var tweets = setInterval(function () { - getBieberTweet(function (tweet) { - socket.volatile.emit('bieber tweet', tweet); - }); - }, 100); - - socket.on('disconnect', function () { - clearInterval(tweets); - }); -}); -``` - -#### Client side - -In the client side, messages are received the same way whether they're volatile -or not. - -### Getting acknowledgements - -Sometimes, you might want to get a callback when the client confirmed the message -reception. - -To do this, simply pass a function as the last parameter of `.send` or `.emit`. -What's more, when you use `.emit`, the acknowledgement is done by you, which -means you can also pass data along: - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.on('ferret', function (name, fn) { - fn('woot'); - }); -}); -``` - -#### Client side - -```html - -``` - -### Broadcasting messages - -To broadcast, simply add a `broadcast` flag to `emit` and `send` method calls. -Broadcasting means sending a message to everyone else except for the socket -that starts it. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.broadcast.emit('user connected'); - socket.broadcast.json.send({ a: 'message' }); -}); -``` - -### Rooms - -Sometimes you want to put certain sockets in the same room, so that it's easy -to broadcast to all of them together. - -Think of this as built-in channels for sockets. Sockets `join` and `leave` -rooms in each socket. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.join('justin bieber fans'); - socket.broadcast.to('justin bieber fans').emit('new fan'); - io.sockets.in('rammstein fans').emit('new non-fan'); -}); -``` - -### Using it just as a cross-browser WebSocket - -If you just want the WebSocket semantics, you can do that too. -Simply leverage `send` and listen on the `message` event: - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.on('message', function () { }); - socket.on('disconnect', function () { }); -}); -``` - -#### Client side - -```html - -``` - -### Changing configuration - -Configuration in socket.io is TJ-style: - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.configure(function () { - io.set('transports', ['websocket', 'flashsocket', 'xhr-polling']); -}); - -io.configure('development', function () { - io.set('transports', ['websocket', 'xhr-polling']); - io.enable('log'); -}); -``` - -## License - -(The MIT License) - -Copyright (c) 2011 Guillermo Rauch <guillermo@learnboost.com> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/socket.io/benchmarks/decode.bench.js b/realtime/node_modules/socket.io/benchmarks/decode.bench.js deleted file mode 100644 index 4855d805..00000000 --- a/realtime/node_modules/socket.io/benchmarks/decode.bench.js +++ /dev/null @@ -1,64 +0,0 @@ - -/** - * Module dependencies. - */ - -var benchmark = require('benchmark') - , colors = require('colors') - , io = require('../') - , parser = io.parser - , suite = new benchmark.Suite('Decode packet'); - -suite.add('string', function () { - parser.decodePacket('4:::"2"'); -}); - -suite.add('event', function () { - parser.decodePacket('5:::{"name":"woot"}'); -}); - -suite.add('event+ack', function () { - parser.decodePacket('5:1+::{"name":"tobi"}'); -}); - -suite.add('event+data', function () { - parser.decodePacket('5:::{"name":"edwald","args":[{"a": "b"},2,"3"]}'); -}); - -suite.add('heartbeat', function () { - parser.decodePacket('2:::'); -}); - -suite.add('error', function () { - parser.decodePacket('7:::2+0'); -}); - -var payload = parser.encodePayload([ - parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbazfoobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) -]); - -suite.add('payload', function () { - parser.decodePayload(payload); -}); - -suite.on('cycle', function (bench, details) { - console.log('\n' + suite.name.grey, details.name.white.bold); - console.log([ - details.hz.toFixed(2).cyan + ' ops/sec'.grey - , details.count.toString().white + ' times executed'.grey - , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey - , - ].join(', '.grey)); -}); - -if (!module.parent) { - suite.run(); -} else { - module.exports = suite; -} diff --git a/realtime/node_modules/socket.io/benchmarks/encode.bench.js b/realtime/node_modules/socket.io/benchmarks/encode.bench.js deleted file mode 100644 index 5037702d..00000000 --- a/realtime/node_modules/socket.io/benchmarks/encode.bench.js +++ /dev/null @@ -1,90 +0,0 @@ - -/** - * Module dependencies. - */ - -var benchmark = require('benchmark') - , colors = require('colors') - , io = require('../') - , parser = io.parser - , suite = new benchmark.Suite('Encode packet'); - -suite.add('string', function () { - parser.encodePacket({ - type: 'json' - , endpoint: '' - , data: '2' - }); -}); - -suite.add('event', function () { - parser.encodePacket({ - type: 'event' - , name: 'woot' - , endpoint: '' - , args: [] - }); -}); - -suite.add('event+ack', function () { - parser.encodePacket({ - type: 'json' - , id: 1 - , ack: 'data' - , endpoint: '' - , data: { a: 'b' } - }); -}); - -suite.add('event+data', function () { - parser.encodePacket({ - type: 'event' - , name: 'edwald' - , endpoint: '' - , args: [{a: 'b'}, 2, '3'] - }); -}); - -suite.add('heartbeat', function () { - parser.encodePacket({ - type: 'heartbeat' - , endpoint: '' - }) -}); - -suite.add('error', function () { - parser.encodePacket({ - type: 'error' - , reason: 'unauthorized' - , advice: 'reconnect' - , endpoint: '' - }) -}) - -suite.add('payload', function () { - parser.encodePayload([ - parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbazfoobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) - ]); -}); - -suite.on('cycle', function (bench, details) { - console.log('\n' + suite.name.grey, details.name.white.bold); - console.log([ - details.hz.toFixed(2).cyan + ' ops/sec'.grey - , details.count.toString().white + ' times executed'.grey - , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey - , - ].join(', '.grey)); -}); - -if (!module.parent) { - suite.run(); -} else { - module.exports = suite; -} diff --git a/realtime/node_modules/socket.io/benchmarks/runner.js b/realtime/node_modules/socket.io/benchmarks/runner.js deleted file mode 100644 index 81e55cae..00000000 --- a/realtime/node_modules/socket.io/benchmarks/runner.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Benchmark runner dependencies - */ - -var colors = require('colors') - , path = require('path'); - -/** - * Find all the benchmarks - */ - -var benchmarks_files = process.env.BENCHMARKS.split(' ') - , all = [].concat(benchmarks_files) - , first = all.shift() - , benchmarks = {}; - -// find the benchmarks and load them all in our obj -benchmarks_files.forEach(function (file) { - benchmarks[file] = require(path.join(__dirname, '..', file)); -}); - -// setup the complete listeners -benchmarks_files.forEach(function (file) { - var benchmark = benchmarks[file] - , next_file = all.shift() - , next = benchmarks[next_file]; - - /** - * Generate a oncomplete function for the tests, either we are done or we - * have more benchmarks to process. - */ - - function complete () { - if (!next) { - console.log( - '\n\nBenchmark completed in'.grey - , (Date.now() - start).toString().green + ' ms'.grey - ); - } else { - console.log('\nStarting benchmark '.grey + next_file.yellow); - next.run(); - } - } - - // attach the listener - benchmark.on('complete', complete); -}); - -/** - * Start the benchmark - */ - -var start = Date.now(); -console.log('Starting benchmark '.grey + first.yellow); -benchmarks[first].run(); diff --git a/realtime/node_modules/socket.io/index.js b/realtime/node_modules/socket.io/index.js deleted file mode 100644 index cc00c103..00000000 --- a/realtime/node_modules/socket.io/index.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -module.exports = require('./lib/socket.io'); diff --git a/realtime/node_modules/socket.io/lib/logger.js b/realtime/node_modules/socket.io/lib/logger.js deleted file mode 100644 index 49d02c98..00000000 --- a/realtime/node_modules/socket.io/lib/logger.js +++ /dev/null @@ -1,97 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var util = require('./util') - , toArray = util.toArray; - -/** - * Log levels. - */ - -var levels = [ - 'error' - , 'warn' - , 'info' - , 'debug' -]; - -/** - * Colors for log levels. - */ - -var colors = [ - 31 - , 33 - , 36 - , 90 -]; - -/** - * Pads the nice output to the longest log level. - */ - -function pad (str) { - var max = 0; - - for (var i = 0, l = levels.length; i < l; i++) - max = Math.max(max, levels[i].length); - - if (str.length < max) - return str + new Array(max - str.length + 1).join(' '); - - return str; -}; - -/** - * Logger (console). - * - * @api public - */ - -var Logger = module.exports = function (opts) { - opts = opts || {} - this.colors = false !== opts.colors; - this.level = 3; - this.enabled = true; -}; - -/** - * Log method. - * - * @api public - */ - -Logger.prototype.log = function (type) { - var index = levels.indexOf(type); - - if (index > this.level || !this.enabled) - return this; - - console.log.apply( - console - , [this.colors - ? ' \033[' + colors[index] + 'm' + pad(type) + ' -\033[39m' - : type + ':' - ].concat(toArray(arguments).slice(1)) - ); - - return this; -}; - -/** - * Generate methods. - */ - -levels.forEach(function (name) { - Logger.prototype[name] = function () { - this.log.apply(this, [name].concat(toArray(arguments))); - }; -}); diff --git a/realtime/node_modules/socket.io/lib/manager.js b/realtime/node_modules/socket.io/lib/manager.js deleted file mode 100644 index b3ea7d92..00000000 --- a/realtime/node_modules/socket.io/lib/manager.js +++ /dev/null @@ -1,1026 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , url = require('url') - , tty = require('tty') - , crypto = require('crypto') - , util = require('./util') - , store = require('./store') - , client = require('socket.io-client') - , transports = require('./transports') - , Logger = require('./logger') - , Socket = require('./socket') - , MemoryStore = require('./stores/memory') - , SocketNamespace = require('./namespace') - , Static = require('./static') - , EventEmitter = process.EventEmitter; - -/** - * Export the constructor. - */ - -exports = module.exports = Manager; - -/** - * Default transports. - */ - -var defaultTransports = exports.defaultTransports = [ - 'websocket' - , 'htmlfile' - , 'xhr-polling' - , 'jsonp-polling' -]; - -/** - * Inherited defaults. - */ - -var parent = module.parent.exports - , protocol = parent.protocol - , jsonpolling_re = /^\d+$/; - -/** - * Manager constructor. - * - * @param {HTTPServer} server - * @param {Object} options, optional - * @api public - */ - -function Manager (server, options) { - this.server = server; - this.namespaces = {}; - this.sockets = this.of(''); - this.settings = { - origins: '*:*' - , log: true - , store: new MemoryStore - , logger: new Logger - , static: new Static(this) - , heartbeats: true - , resource: '/socket.io' - , transports: defaultTransports - , authorization: false - , blacklist: ['disconnect'] - , 'log level': 3 - , 'log colors': tty.isatty(process.stdout.fd) - , 'close timeout': 60 - , 'heartbeat interval': 25 - , 'heartbeat timeout': 60 - , 'polling duration': 20 - , 'flash policy server': true - , 'flash policy port': 10843 - , 'destroy upgrade': true - , 'destroy buffer size': 10E7 - , 'browser client': true - , 'browser client cache': true - , 'browser client minification': false - , 'browser client etag': false - , 'browser client expires': 315360000 - , 'browser client gzip': false - , 'browser client handler': false - , 'client store expiration': 15 - , 'match origin protocol': false - }; - - for (var i in options) { - if (options.hasOwnProperty(i)) { - this.settings[i] = options[i]; - } - } - - var self = this; - - // default error handler - server.on('error', function(err) { - self.log.warn('error raised: ' + err); - }); - - this.initStore(); - - this.on('set:store', function() { - self.initStore(); - }); - - // reset listeners - this.oldListeners = server.listeners('request').splice(0); - server.removeAllListeners('request'); - - server.on('request', function (req, res) { - self.handleRequest(req, res); - }); - - server.on('upgrade', function (req, socket, head) { - self.handleUpgrade(req, socket, head); - }); - - server.on('close', function () { - clearInterval(self.gc); - }); - - server.once('listening', function () { - self.gc = setInterval(self.garbageCollection.bind(self), 10000); - }); - - for (var i in transports) { - if (transports.hasOwnProperty(i)) { - if (transports[i].init) { - transports[i].init(this); - } - } - } - - // forward-compatibility with 1.0 - var self = this; - this.sockets.on('connection', function (conn) { - self.emit('connection', conn); - }); - - this.sequenceNumber = Date.now() | 0; - - this.log.info('socket.io started'); -}; - -Manager.prototype.__proto__ = EventEmitter.prototype - -/** - * Store accessor shortcut. - * - * @api public - */ - -Manager.prototype.__defineGetter__('store', function () { - var store = this.get('store'); - store.manager = this; - return store; -}); - -/** - * Logger accessor. - * - * @api public - */ - -Manager.prototype.__defineGetter__('log', function () { - var logger = this.get('logger'); - - logger.level = this.get('log level') || -1; - logger.colors = this.get('log colors'); - logger.enabled = this.enabled('log'); - - return logger; -}); - -/** - * Static accessor. - * - * @api public - */ - -Manager.prototype.__defineGetter__('static', function () { - return this.get('static'); -}); - -/** - * Get settings. - * - * @api public - */ - -Manager.prototype.get = function (key) { - return this.settings[key]; -}; - -/** - * Set settings - * - * @api public - */ - -Manager.prototype.set = function (key, value) { - if (arguments.length == 1) return this.get(key); - this.settings[key] = value; - this.emit('set:' + key, this.settings[key], key); - return this; -}; - -/** - * Enable a setting - * - * @api public - */ - -Manager.prototype.enable = function (key) { - this.settings[key] = true; - this.emit('set:' + key, this.settings[key], key); - return this; -}; - -/** - * Disable a setting - * - * @api public - */ - -Manager.prototype.disable = function (key) { - this.settings[key] = false; - this.emit('set:' + key, this.settings[key], key); - return this; -}; - -/** - * Checks if a setting is enabled - * - * @api public - */ - -Manager.prototype.enabled = function (key) { - return !!this.settings[key]; -}; - -/** - * Checks if a setting is disabled - * - * @api public - */ - -Manager.prototype.disabled = function (key) { - return !this.settings[key]; -}; - -/** - * Configure callbacks. - * - * @api public - */ - -Manager.prototype.configure = function (env, fn) { - if ('function' == typeof env) { - env.call(this); - } else if (env == (process.env.NODE_ENV || 'development')) { - fn.call(this); - } - - return this; -}; - -/** - * Initializes everything related to the message dispatcher. - * - * @api private - */ - -Manager.prototype.initStore = function () { - this.handshaken = {}; - this.connected = {}; - this.open = {}; - this.closed = {}; - this.rooms = {}; - this.roomClients = {}; - - var self = this; - - this.store.subscribe('handshake', function (id, data) { - self.onHandshake(id, data); - }); - - this.store.subscribe('connect', function (id) { - self.onConnect(id); - }); - - this.store.subscribe('open', function (id) { - self.onOpen(id); - }); - - this.store.subscribe('join', function (id, room) { - self.onJoin(id, room); - }); - - this.store.subscribe('leave', function (id, room) { - self.onLeave(id, room); - }); - - this.store.subscribe('close', function (id) { - self.onClose(id); - }); - - this.store.subscribe('dispatch', function (room, packet, volatile, exceptions) { - self.onDispatch(room, packet, volatile, exceptions); - }); - - this.store.subscribe('disconnect', function (id) { - self.onDisconnect(id); - }); -}; - -/** - * Called when a client handshakes. - * - * @param text - */ - -Manager.prototype.onHandshake = function (id, data) { - this.handshaken[id] = data; -}; - -/** - * Called when a client connects (ie: transport first opens) - * - * @api private - */ - -Manager.prototype.onConnect = function (id) { - this.connected[id] = true; -}; - -/** - * Called when a client opens a request in a different node. - * - * @api private - */ - -Manager.prototype.onOpen = function (id) { - this.open[id] = true; - - if (this.closed[id]) { - var self = this; - - this.store.unsubscribe('dispatch:' + id, function () { - var transport = self.transports[id]; - if (self.closed[id] && self.closed[id].length && transport) { - - // if we have buffered messages that accumulate between calling - // onOpen an this async callback, send them if the transport is - // still open, otherwise leave them buffered - if (transport.open) { - transport.payload(self.closed[id]); - self.closed[id] = []; - } - } - }); - } - - // clear the current transport - if (this.transports[id]) { - this.transports[id].discard(); - this.transports[id] = null; - } -}; - -/** - * Called when a message is sent to a namespace and/or room. - * - * @api private - */ - -Manager.prototype.onDispatch = function (room, packet, volatile, exceptions) { - if (this.rooms[room]) { - for (var i = 0, l = this.rooms[room].length; i < l; i++) { - var id = this.rooms[room][i]; - - if (!~exceptions.indexOf(id)) { - if (this.transports[id] && this.transports[id].open) { - this.transports[id].onDispatch(packet, volatile); - } else if (!volatile) { - this.onClientDispatch(id, packet); - } - } - } - } -}; - -/** - * Called when a client joins a nsp / room. - * - * @api private - */ - -Manager.prototype.onJoin = function (id, name) { - if (!this.roomClients[id]) { - this.roomClients[id] = {}; - } - - if (!this.rooms[name]) { - this.rooms[name] = []; - } - - if (!~this.rooms[name].indexOf(id)) { - this.rooms[name].push(id); - this.roomClients[id][name] = true; - } -}; - -/** - * Called when a client leaves a nsp / room. - * - * @param private - */ - -Manager.prototype.onLeave = function (id, room) { - if (this.rooms[room]) { - var index = this.rooms[room].indexOf(id); - - if (index >= 0) { - this.rooms[room].splice(index, 1); - } - - if (!this.rooms[room].length) { - delete this.rooms[room]; - } - - if (this.roomClients[id]) { - delete this.roomClients[id][room]; - } - } -}; - -/** - * Called when a client closes a request in different node. - * - * @api private - */ - -Manager.prototype.onClose = function (id) { - if (this.open[id]) { - delete this.open[id]; - } - - this.closed[id] = []; - - var self = this; - - this.store.subscribe('dispatch:' + id, function (packet, volatile) { - if (!volatile) { - self.onClientDispatch(id, packet); - } - }); -}; - -/** - * Dispatches a message for a closed client. - * - * @api private - */ - -Manager.prototype.onClientDispatch = function (id, packet) { - if (this.closed[id]) { - this.closed[id].push(packet); - } -}; - -/** - * Receives a message for a client. - * - * @api private - */ - -Manager.prototype.onClientMessage = function (id, packet) { - if (this.namespaces[packet.endpoint]) { - this.namespaces[packet.endpoint].handlePacket(id, packet); - } -}; - -/** - * Fired when a client disconnects (not triggered). - * - * @api private - */ - -Manager.prototype.onClientDisconnect = function (id, reason) { - for (var name in this.namespaces) { - if (this.namespaces.hasOwnProperty(name)) { - this.namespaces[name].handleDisconnect(id, reason, typeof this.roomClients[id] !== 'undefined' && - typeof this.roomClients[id][name] !== 'undefined'); - } - } - - this.onDisconnect(id); -}; - -/** - * Called when a client disconnects. - * - * @param text - */ - -Manager.prototype.onDisconnect = function (id, local) { - delete this.handshaken[id]; - - if (this.open[id]) { - delete this.open[id]; - } - - if (this.connected[id]) { - delete this.connected[id]; - } - - if (this.transports[id]) { - this.transports[id].discard(); - delete this.transports[id]; - } - - if (this.closed[id]) { - delete this.closed[id]; - } - - if (this.roomClients[id]) { - for (var room in this.roomClients[id]) { - if (this.roomClients[id].hasOwnProperty(room)) { - this.onLeave(id, room); - } - } - delete this.roomClients[id] - } - - this.store.destroyClient(id, this.get('client store expiration')); - - this.store.unsubscribe('dispatch:' + id); - - if (local) { - this.store.unsubscribe('message:' + id); - this.store.unsubscribe('disconnect:' + id); - } -}; - -/** - * Handles an HTTP request. - * - * @api private - */ - -Manager.prototype.handleRequest = function (req, res) { - var data = this.checkRequest(req); - - if (!data) { - for (var i = 0, l = this.oldListeners.length; i < l; i++) { - this.oldListeners[i].call(this.server, req, res); - } - - return; - } - - if (data.static || !data.transport && !data.protocol) { - if (data.static && this.enabled('browser client')) { - this.static.write(data.path, req, res); - } else { - res.writeHead(200); - res.end('Welcome to socket.io.'); - - this.log.info('unhandled socket.io url'); - } - - return; - } - - if (data.protocol != protocol) { - res.writeHead(500); - res.end('Protocol version not supported.'); - - this.log.info('client protocol version unsupported'); - } else { - if (data.id) { - this.handleHTTPRequest(data, req, res); - } else { - this.handleHandshake(data, req, res); - } - } -}; - -/** - * Handles an HTTP Upgrade. - * - * @api private - */ - -Manager.prototype.handleUpgrade = function (req, socket, head) { - var data = this.checkRequest(req) - , self = this; - - if (!data) { - if (this.enabled('destroy upgrade')) { - socket.end(); - this.log.debug('destroying non-socket.io upgrade'); - } - - return; - } - - req.head = head; - this.handleClient(data, req); -}; - -/** - * Handles a normal handshaken HTTP request (eg: long-polling) - * - * @api private - */ - -Manager.prototype.handleHTTPRequest = function (data, req, res) { - req.res = res; - this.handleClient(data, req); -}; - -/** - * Intantiantes a new client. - * - * @api private - */ - -Manager.prototype.handleClient = function (data, req) { - var socket = req.socket - , store = this.store - , self = this; - - // handle sync disconnect xhrs - if (undefined != data.query.disconnect) { - if (this.transports[data.id] && this.transports[data.id].open) { - this.transports[data.id].onForcedDisconnect(); - } else { - this.store.publish('disconnect-force:' + data.id); - } - req.res.writeHead(200); - req.res.end(); - return; - } - - if (!~this.get('transports').indexOf(data.transport)) { - this.log.warn('unknown transport: "' + data.transport + '"'); - req.connection.end(); - return; - } - - var transport = new transports[data.transport](this, data, req) - , handshaken = this.handshaken[data.id]; - - if (transport.disconnected) { - // failed during transport setup - req.connection.end(); - return; - } - if (handshaken) { - if (transport.open) { - if (this.closed[data.id] && this.closed[data.id].length) { - transport.payload(this.closed[data.id]); - this.closed[data.id] = []; - } - - this.onOpen(data.id); - this.store.publish('open', data.id); - this.transports[data.id] = transport; - } - - if (!this.connected[data.id]) { - this.onConnect(data.id); - this.store.publish('connect', data.id); - - // flag as used - delete handshaken.issued; - this.onHandshake(data.id, handshaken); - this.store.publish('handshake', data.id, handshaken); - - // initialize the socket for all namespaces - for (var i in this.namespaces) { - if (this.namespaces.hasOwnProperty(i)) { - var socket = this.namespaces[i].socket(data.id, true); - - // echo back connect packet and fire connection event - if (i === '') { - this.namespaces[i].handlePacket(data.id, { type: 'connect' }); - } - } - } - - this.store.subscribe('message:' + data.id, function (packet) { - self.onClientMessage(data.id, packet); - }); - - this.store.subscribe('disconnect:' + data.id, function (reason) { - self.onClientDisconnect(data.id, reason); - }); - } - } else { - if (transport.open) { - transport.error('client not handshaken', 'reconnect'); - } - - transport.discard(); - } -}; - -/** - * Generates a session id. - * - * @api private - */ - -Manager.prototype.generateId = function () { - var rand = new Buffer(15); // multiple of 3 for base64 - if (!rand.writeInt32BE) { - return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString() - + Math.abs(Math.random() * Math.random() * Date.now() | 0).toString(); - } - this.sequenceNumber = (this.sequenceNumber + 1) | 0; - rand.writeInt32BE(this.sequenceNumber, 11); - if (crypto.randomBytes) { - crypto.randomBytes(12).copy(rand); - } else { - // not secure for node 0.4 - [0, 4, 8].forEach(function(i) { - rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i); - }); - } - return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-'); -}; - -/** - * Handles a handshake request. - * - * @api private - */ - -Manager.prototype.handleHandshake = function (data, req, res) { - var self = this - , origin = req.headers.origin - , headers = { - 'Content-Type': 'text/plain' - }; - - function writeErr (status, message) { - if (data.query.jsonp && jsonpolling_re.test(data.query.jsonp)) { - res.writeHead(200, { 'Content-Type': 'application/javascript' }); - res.end('io.j[' + data.query.jsonp + '](new Error("' + message + '"));'); - } else { - res.writeHead(status, headers); - res.end(message); - } - }; - - function error (err) { - writeErr(500, 'handshake error'); - self.log.warn('handshake error ' + err); - }; - - if (!this.verifyOrigin(req)) { - writeErr(403, 'handshake bad origin'); - return; - } - - var handshakeData = this.handshakeData(data); - - if (origin) { - // https://developer.mozilla.org/En/HTTP_Access_Control - headers['Access-Control-Allow-Origin'] = origin; - headers['Access-Control-Allow-Credentials'] = 'true'; - } - - this.authorize(handshakeData, function (err, authorized, newData) { - if (err) return error(err); - - if (authorized) { - var id = self.generateId() - , hs = [ - id - , self.enabled('heartbeats') ? self.get('heartbeat timeout') || '' : '' - , self.get('close timeout') || '' - , self.transports(data).join(',') - ].join(':'); - - if (data.query.jsonp && jsonpolling_re.test(data.query.jsonp)) { - hs = 'io.j[' + data.query.jsonp + '](' + JSON.stringify(hs) + ');'; - res.writeHead(200, { 'Content-Type': 'application/javascript' }); - } else { - res.writeHead(200, headers); - } - - res.end(hs); - - self.onHandshake(id, newData || handshakeData); - self.store.publish('handshake', id, newData || handshakeData); - - self.log.info('handshake authorized', id); - } else { - writeErr(403, 'handshake unauthorized'); - self.log.info('handshake unauthorized'); - } - }) -}; - -/** - * Gets normalized handshake data - * - * @api private - */ - -Manager.prototype.handshakeData = function (data) { - var connection = data.request.connection - , connectionAddress - , date = new Date; - - if (connection.remoteAddress) { - connectionAddress = { - address: connection.remoteAddress - , port: connection.remotePort - }; - } else if (connection.socket && connection.socket.remoteAddress) { - connectionAddress = { - address: connection.socket.remoteAddress - , port: connection.socket.remotePort - }; - } - - return { - headers: data.headers - , address: connectionAddress - , time: date.toString() - , query: data.query - , url: data.request.url - , xdomain: !!data.request.headers.origin - , secure: data.request.connection.secure - , issued: +date - }; -}; - -/** - * Verifies the origin of a request. - * - * @api private - */ - -Manager.prototype.verifyOrigin = function (request) { - var origin = request.headers.origin || request.headers.referer - , origins = this.get('origins'); - - if (origin === 'null') origin = '*'; - - if (origins.indexOf('*:*') !== -1) { - return true; - } - - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~origins.indexOf(parts.hostname + ':' + parts.port) || - ~origins.indexOf(parts.hostname + ':*') || - ~origins.indexOf('*:' + parts.port); - if (!ok) this.log.warn('illegal origin: ' + origin); - return ok; - } catch (ex) { - this.log.warn('error parsing origin'); - } - } - else { - this.log.warn('origin missing from handshake, yet required by config'); - } - return false; -}; - -/** - * Handles an incoming packet. - * - * @api private - */ - -Manager.prototype.handlePacket = function (sessid, packet) { - this.of(packet.endpoint || '').handlePacket(sessid, packet); -}; - -/** - * Performs authentication. - * - * @param Object client request data - * @api private - */ - -Manager.prototype.authorize = function (data, fn) { - if (this.get('authorization')) { - var self = this; - - this.get('authorization').call(this, data, function (err, authorized) { - self.log.debug('client ' + authorized ? 'authorized' : 'unauthorized'); - fn(err, authorized); - }); - } else { - this.log.debug('client authorized'); - fn(null, true); - } - - return this; -}; - -/** - * Retrieves the transports adviced to the user. - * - * @api private - */ - -Manager.prototype.transports = function (data) { - var transp = this.get('transports') - , ret = []; - - for (var i = 0, l = transp.length; i < l; i++) { - var transport = transp[i]; - - if (transport) { - if (!transport.checkClient || transport.checkClient(data)) { - ret.push(transport); - } - } - } - - return ret; -}; - -/** - * Checks whether a request is a socket.io one. - * - * @return {Object} a client request data object or `false` - * @api private - */ - -var regexp = /^\/([^\/]+)\/?([^\/]+)?\/?([^\/]+)?\/?$/ - -Manager.prototype.checkRequest = function (req) { - var resource = this.get('resource'); - - var match; - if (typeof resource === 'string') { - match = req.url.substr(0, resource.length); - if (match !== resource) match = null; - } else { - match = resource.exec(req.url); - if (match) match = match[0]; - } - - if (match) { - var uri = url.parse(req.url.substr(match.length), true) - , path = uri.pathname || '' - , pieces = path.match(regexp); - - // client request data - var data = { - query: uri.query || {} - , headers: req.headers - , request: req - , path: path - }; - - if (pieces) { - data.protocol = Number(pieces[1]); - data.transport = pieces[2]; - data.id = pieces[3]; - data.static = !!this.static.has(path); - }; - - return data; - } - - return false; -}; - -/** - * Declares a socket namespace - * - * @api public - */ - -Manager.prototype.of = function (nsp) { - if (this.namespaces[nsp]) { - return this.namespaces[nsp]; - } - - return this.namespaces[nsp] = new SocketNamespace(this, nsp); -}; - -/** - * Perform garbage collection on long living objects and properties that cannot - * be removed automatically. - * - * @api private - */ - -Manager.prototype.garbageCollection = function () { - // clean up unused handshakes - var ids = Object.keys(this.handshaken) - , i = ids.length - , now = Date.now() - , handshake; - - while (i--) { - handshake = this.handshaken[ids[i]]; - - if ('issued' in handshake && (now - handshake.issued) >= 3E4) { - this.onDisconnect(ids[i]); - } - } -}; diff --git a/realtime/node_modules/socket.io/lib/namespace.js b/realtime/node_modules/socket.io/lib/namespace.js deleted file mode 100644 index 6e1e1c92..00000000 --- a/realtime/node_modules/socket.io/lib/namespace.js +++ /dev/null @@ -1,355 +0,0 @@ -/** - * Module dependencies. - */ - -var Socket = require('./socket') - , EventEmitter = process.EventEmitter - , parser = require('./parser') - , util = require('./util'); - -/** - * Exports the constructor. - */ - -exports = module.exports = SocketNamespace; - -/** - * Constructor. - * - * @api public. - */ - -function SocketNamespace (mgr, name) { - this.manager = mgr; - this.name = name || ''; - this.sockets = {}; - this.auth = false; - this.setFlags(); -}; - -/** - * Inherits from EventEmitter. - */ - -SocketNamespace.prototype.__proto__ = EventEmitter.prototype; - -/** - * Copies emit since we override it. - * - * @api private - */ - -SocketNamespace.prototype.$emit = EventEmitter.prototype.emit; - -/** - * Retrieves all clients as Socket instances as an array. - * - * @api public - */ - -SocketNamespace.prototype.clients = function (room) { - var room = this.name + (room !== undefined ? - '/' + room : ''); - - if (!this.manager.rooms[room]) { - return []; - } - - return this.manager.rooms[room].map(function (id) { - return this.socket(id); - }, this); -}; - -/** - * Access logger interface. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('log', function () { - return this.manager.log; -}); - -/** - * Access store. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('store', function () { - return this.manager.store; -}); - -/** - * JSON message flag. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('json', function () { - this.flags.json = true; - return this; -}); - -/** - * Volatile message flag. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('volatile', function () { - this.flags.volatile = true; - return this; -}); - -/** - * Overrides the room to relay messages to (flag). - * - * @api public - */ - -SocketNamespace.prototype.in = SocketNamespace.prototype.to = function (room) { - this.flags.endpoint = this.name + (room ? '/' + room : ''); - return this; -}; - -/** - * Adds a session id we should prevent relaying messages to (flag). - * - * @api public - */ - -SocketNamespace.prototype.except = function (id) { - this.flags.exceptions.push(id); - return this; -}; - -/** - * Sets the default flags. - * - * @api private - */ - -SocketNamespace.prototype.setFlags = function () { - this.flags = { - endpoint: this.name - , exceptions: [] - }; - return this; -}; - -/** - * Sends out a packet. - * - * @api private - */ - -SocketNamespace.prototype.packet = function (packet) { - packet.endpoint = this.name; - - var store = this.store - , log = this.log - , volatile = this.flags.volatile - , exceptions = this.flags.exceptions - , packet = parser.encodePacket(packet); - - this.manager.onDispatch(this.flags.endpoint, packet, volatile, exceptions); - this.store.publish('dispatch', this.flags.endpoint, packet, volatile, exceptions); - - this.setFlags(); - - return this; -}; - -/** - * Sends to everyone. - * - * @api public - */ - -SocketNamespace.prototype.send = function (data) { - return this.packet({ - type: this.flags.json ? 'json' : 'message' - , data: data - }); -}; - -/** - * Emits to everyone (override). - * - * @api public - */ - -SocketNamespace.prototype.emit = function (name) { - if (name == 'newListener') { - return this.$emit.apply(this, arguments); - } - - return this.packet({ - type: 'event' - , name: name - , args: util.toArray(arguments).slice(1) - }); -}; - -/** - * Retrieves or creates a write-only socket for a client, unless specified. - * - * @param {Boolean} whether the socket will be readable when initialized - * @api public - */ - -SocketNamespace.prototype.socket = function (sid, readable) { - if (!this.sockets[sid]) { - this.sockets[sid] = new Socket(this.manager, sid, this, readable); - } - - return this.sockets[sid]; -}; - -/** - * Sets authorization for this namespace. - * - * @api public - */ - -SocketNamespace.prototype.authorization = function (fn) { - this.auth = fn; - return this; -}; - -/** - * Called when a socket disconnects entirely. - * - * @api private - */ - -SocketNamespace.prototype.handleDisconnect = function (sid, reason, raiseOnDisconnect) { - if (this.sockets[sid] && this.sockets[sid].readable) { - if (raiseOnDisconnect) this.sockets[sid].onDisconnect(reason); - delete this.sockets[sid]; - } -}; - -/** - * Performs authentication. - * - * @param Object client request data - * @api private - */ - -SocketNamespace.prototype.authorize = function (data, fn) { - if (this.auth) { - var self = this; - - this.auth.call(this, data, function (err, authorized) { - self.log.debug('client ' + - (authorized ? '' : 'un') + 'authorized for ' + self.name); - fn(err, authorized); - }); - } else { - this.log.debug('client authorized for ' + this.name); - fn(null, true); - } - - return this; -}; - -/** - * Handles a packet. - * - * @api private - */ - -SocketNamespace.prototype.handlePacket = function (sessid, packet) { - var socket = this.socket(sessid) - , dataAck = packet.ack == 'data' - , manager = this.manager - , self = this; - - function ack () { - self.log.debug('sending data ack packet'); - socket.packet({ - type: 'ack' - , args: util.toArray(arguments) - , ackId: packet.id - }); - }; - - function error (err) { - self.log.warn('handshake error ' + err + ' for ' + self.name); - socket.packet({ type: 'error', reason: err }); - }; - - function connect () { - self.manager.onJoin(sessid, self.name); - self.store.publish('join', sessid, self.name); - - // packet echo - socket.packet({ type: 'connect' }); - - // emit connection event - self.$emit('connection', socket); - }; - - switch (packet.type) { - case 'connect': - if (packet.endpoint == '') { - connect(); - } else { - var handshakeData = manager.handshaken[sessid]; - - this.authorize(handshakeData, function (err, authorized, newData) { - if (err) return error(err); - - if (authorized) { - manager.onHandshake(sessid, newData || handshakeData); - self.store.publish('handshake', sessid, newData || handshakeData); - connect(); - } else { - error('unauthorized'); - } - }); - } - break; - - case 'ack': - if (socket.acks[packet.ackId]) { - socket.acks[packet.ackId].apply(socket, packet.args); - } else { - this.log.info('unknown ack packet'); - } - break; - - case 'event': - // check if the emitted event is not blacklisted - if (-~manager.get('blacklist').indexOf(packet.name)) { - this.log.debug('ignoring blacklisted event `' + packet.name + '`'); - } else { - var params = [packet.name].concat(packet.args); - - if (dataAck) { - params.push(ack); - } - - socket.$emit.apply(socket, params); - } - break; - - case 'disconnect': - this.manager.onLeave(sessid, this.name); - this.store.publish('leave', sessid, this.name); - - socket.$emit('disconnect', packet.reason || 'packet'); - break; - - case 'json': - case 'message': - var params = ['message', packet.data]; - - if (dataAck) - params.push(ack); - - socket.$emit.apply(socket, params); - }; -}; diff --git a/realtime/node_modules/socket.io/lib/parser.js b/realtime/node_modules/socket.io/lib/parser.js deleted file mode 100644 index d56b5500..00000000 --- a/realtime/node_modules/socket.io/lib/parser.js +++ /dev/null @@ -1,249 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -/** - * Packet types. - */ - -var packets = exports.packets = { - 'disconnect': 0 - , 'connect': 1 - , 'heartbeat': 2 - , 'message': 3 - , 'json': 4 - , 'event': 5 - , 'ack': 6 - , 'error': 7 - , 'noop': 8 - } - , packetslist = Object.keys(packets); - -/** - * Errors reasons. - */ - -var reasons = exports.reasons = { - 'transport not supported': 0 - , 'client not handshaken': 1 - , 'unauthorized': 2 - } - , reasonslist = Object.keys(reasons); - -/** - * Errors advice. - */ - -var advice = exports.advice = { - 'reconnect': 0 - } - , advicelist = Object.keys(advice); - -/** - * Encodes a packet. - * - * @api private - */ - -exports.encodePacket = function (packet) { - var type = packets[packet.type] - , id = packet.id || '' - , endpoint = packet.endpoint || '' - , ack = packet.ack - , data = null; - - switch (packet.type) { - case 'message': - if (packet.data !== '') - data = packet.data; - break; - - case 'event': - var ev = { name: packet.name }; - - if (packet.args && packet.args.length) { - ev.args = packet.args; - } - - data = JSON.stringify(ev); - break; - - case 'json': - data = JSON.stringify(packet.data); - break; - - case 'ack': - data = packet.ackId - + (packet.args && packet.args.length - ? '+' + JSON.stringify(packet.args) : ''); - break; - - case 'connect': - if (packet.qs) - data = packet.qs; - break; - - case 'error': - var reason = packet.reason ? reasons[packet.reason] : '' - , adv = packet.advice ? advice[packet.advice] : '' - - if (reason !== '' || adv !== '') - data = reason + (adv !== '' ? ('+' + adv) : '') - - break; - } - - // construct packet with required fragments - var encoded = type + ':' + id + (ack == 'data' ? '+' : '') + ':' + endpoint; - - // data fragment is optional - if (data !== null && data !== undefined) - encoded += ':' + data; - - return encoded; -}; - -/** - * Encodes multiple messages (payload). - * - * @param {Array} messages - * @api private - */ - -exports.encodePayload = function (packets) { - var decoded = ''; - - if (packets.length == 1) - return packets[0]; - - for (var i = 0, l = packets.length; i < l; i++) { - var packet = packets[i]; - decoded += '\ufffd' + packet.length + '\ufffd' + packets[i] - } - - return decoded; -}; - -/** - * Decodes a packet - * - * @api private - */ - -var regexp = /([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/; - -/** - * Wrap the JSON.parse in a seperate function the crankshaft optimizer will - * only punish this function for the usage for try catch - * - * @api private - */ - -function parse (data) { - try { return JSON.parse(data) } - catch (e) { return false } -} - -exports.decodePacket = function (data) { - var pieces = data.match(regexp); - - if (!pieces) return {}; - - var id = pieces[2] || '' - , data = pieces[5] || '' - , packet = { - type: packetslist[pieces[1]] - , endpoint: pieces[4] || '' - }; - - // whether we need to acknowledge the packet - if (id) { - packet.id = id; - if (pieces[3]) - packet.ack = 'data'; - else - packet.ack = true; - } - - // handle different packet types - switch (packet.type) { - case 'message': - packet.data = data || ''; - break; - - case 'event': - pieces = parse(data); - if (pieces) { - packet.name = pieces.name; - packet.args = pieces.args; - } - - packet.args = packet.args || []; - break; - - case 'json': - packet.data = parse(data); - break; - - case 'connect': - packet.qs = data || ''; - break; - - case 'ack': - pieces = data.match(/^([0-9]+)(\+)?(.*)/); - if (pieces) { - packet.ackId = pieces[1]; - packet.args = []; - - if (pieces[3]) { - packet.args = parse(pieces[3]) || []; - } - } - break; - - case 'error': - pieces = data.split('+'); - packet.reason = reasonslist[pieces[0]] || ''; - packet.advice = advicelist[pieces[1]] || ''; - } - - return packet; -}; - -/** - * Decodes data payload. Detects multiple messages - * - * @return {Array} messages - * @api public - */ - -exports.decodePayload = function (data) { - if (undefined == data || null == data) { - return []; - } - - if (data[0] == '\ufffd') { - var ret = []; - - for (var i = 1, length = ''; i < data.length; i++) { - if (data[i] == '\ufffd') { - ret.push(exports.decodePacket(data.substr(i + 1, length))); - i += Number(length) + 1; - length = ''; - } else { - length += data[i]; - } - } - - return ret; - } else { - return [exports.decodePacket(data)]; - } -}; diff --git a/realtime/node_modules/socket.io/lib/socket.io.js b/realtime/node_modules/socket.io/lib/socket.io.js deleted file mode 100644 index bf590364..00000000 --- a/realtime/node_modules/socket.io/lib/socket.io.js +++ /dev/null @@ -1,143 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var client = require('socket.io-client'); - -/** - * Version. - */ - -exports.version = '0.9.11'; - -/** - * Supported protocol version. - */ - -exports.protocol = 1; - -/** - * Client that we serve. - */ - -exports.clientVersion = client.version; - -/** - * Attaches a manager - * - * @param {HTTPServer/Number} a HTTP/S server or a port number to listen on. - * @param {Object} opts to be passed to Manager and/or http server - * @param {Function} callback if a port is supplied - * @api public - */ - -exports.listen = function (server, options, fn) { - if ('function' == typeof server) { - console.warn('Socket.IO\'s `listen()` method expects an `http.Server` instance\n' - + 'as its first parameter. Are you migrating from Express 2.x to 3.x?\n' - + 'If so, check out the "Socket.IO compatibility" section at:\n' - + 'https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x'); - } - - if ('function' == typeof options) { - fn = options; - options = {}; - } - - if ('undefined' == typeof server) { - // create a server that listens on port 80 - server = 80; - } - - if ('number' == typeof server) { - // if a port number is passed - var port = server; - - if (options && options.key) - server = require('https').createServer(options); - else - server = require('http').createServer(); - - // default response - server.on('request', function (req, res) { - res.writeHead(200); - res.end('Welcome to socket.io.'); - }); - - server.listen(port, fn); - } - - // otherwise assume a http/s server - return new exports.Manager(server, options); -}; - -/** - * Manager constructor. - * - * @api public - */ - -exports.Manager = require('./manager'); - -/** - * Transport constructor. - * - * @api public - */ - -exports.Transport = require('./transport'); - -/** - * Socket constructor. - * - * @api public - */ - -exports.Socket = require('./socket'); - -/** - * Static constructor. - * - * @api public - */ - -exports.Static = require('./static'); - -/** - * Store constructor. - * - * @api public - */ - -exports.Store = require('./store'); - -/** - * Memory Store constructor. - * - * @api public - */ - -exports.MemoryStore = require('./stores/memory'); - -/** - * Redis Store constructor. - * - * @api public - */ - -exports.RedisStore = require('./stores/redis'); - -/** - * Parser. - * - * @api public - */ - -exports.parser = require('./parser'); diff --git a/realtime/node_modules/socket.io/lib/socket.js b/realtime/node_modules/socket.io/lib/socket.js deleted file mode 100644 index d9807f6d..00000000 --- a/realtime/node_modules/socket.io/lib/socket.js +++ /dev/null @@ -1,369 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var parser = require('./parser') - , util = require('./util') - , EventEmitter = process.EventEmitter - -/** - * Export the constructor. - */ - -exports = module.exports = Socket; - -/** - * Default error event listener to prevent uncaught exceptions. - */ - -var defaultError = function () {}; - -/** - * Socket constructor. - * - * @param {Manager} manager instance - * @param {String} session id - * @param {Namespace} namespace the socket belongs to - * @param {Boolean} whether the - * @api public - */ - -function Socket (manager, id, nsp, readable) { - this.id = id; - this.namespace = nsp; - this.manager = manager; - this.disconnected = false; - this.ackPackets = 0; - this.acks = {}; - this.setFlags(); - this.readable = readable; - this.store = this.manager.store.client(this.id); - this.on('error', defaultError); -}; - -/** - * Inherits from EventEmitter. - */ - -Socket.prototype.__proto__ = EventEmitter.prototype; - -/** - * Accessor shortcut for the handshake data - * - * @api private - */ - -Socket.prototype.__defineGetter__('handshake', function () { - return this.manager.handshaken[this.id]; -}); - -/** - * Accessor shortcut for the transport type - * - * @api private - */ - -Socket.prototype.__defineGetter__('transport', function () { - return this.manager.transports[this.id].name; -}); - -/** - * Accessor shortcut for the logger. - * - * @api private - */ - -Socket.prototype.__defineGetter__('log', function () { - return this.manager.log; -}); - -/** - * JSON message flag. - * - * @api public - */ - -Socket.prototype.__defineGetter__('json', function () { - this.flags.json = true; - return this; -}); - -/** - * Volatile message flag. - * - * @api public - */ - -Socket.prototype.__defineGetter__('volatile', function () { - this.flags.volatile = true; - return this; -}); - -/** - * Broadcast message flag. - * - * @api public - */ - -Socket.prototype.__defineGetter__('broadcast', function () { - this.flags.broadcast = true; - return this; -}); - -/** - * Overrides the room to broadcast messages to (flag) - * - * @api public - */ - -Socket.prototype.to = Socket.prototype.in = function (room) { - this.flags.room = room; - return this; -}; - -/** - * Resets flags - * - * @api private - */ - -Socket.prototype.setFlags = function () { - this.flags = { - endpoint: this.namespace.name - , room: '' - }; - return this; -}; - -/** - * Triggered on disconnect - * - * @api private - */ - -Socket.prototype.onDisconnect = function (reason) { - if (!this.disconnected) { - this.$emit('disconnect', reason); - this.disconnected = true; - } -}; - -/** - * Joins a user to a room. - * - * @api public - */ - -Socket.prototype.join = function (name, fn) { - var nsp = this.namespace.name - , name = (nsp + '/') + name; - - this.manager.onJoin(this.id, name); - this.manager.store.publish('join', this.id, name); - - if (fn) { - this.log.warn('Client#join callback is deprecated'); - fn(); - } - - return this; -}; - -/** - * Un-joins a user from a room. - * - * @api public - */ - -Socket.prototype.leave = function (name, fn) { - var nsp = this.namespace.name - , name = (nsp + '/') + name; - - this.manager.onLeave(this.id, name); - this.manager.store.publish('leave', this.id, name); - - if (fn) { - this.log.warn('Client#leave callback is deprecated'); - fn(); - } - - return this; -}; - -/** - * Transmits a packet. - * - * @api private - */ - -Socket.prototype.packet = function (packet) { - if (this.flags.broadcast) { - this.log.debug('broadcasting packet'); - this.namespace.in(this.flags.room).except(this.id).packet(packet); - } else { - packet.endpoint = this.flags.endpoint; - packet = parser.encodePacket(packet); - - this.dispatch(packet, this.flags.volatile); - } - - this.setFlags(); - - return this; -}; - -/** - * Dispatches a packet - * - * @api private - */ - -Socket.prototype.dispatch = function (packet, volatile) { - if (this.manager.transports[this.id] && this.manager.transports[this.id].open) { - this.manager.transports[this.id].onDispatch(packet, volatile); - } else { - if (!volatile) { - this.manager.onClientDispatch(this.id, packet, volatile); - } - - this.manager.store.publish('dispatch:' + this.id, packet, volatile); - } -}; - -/** - * Stores data for the client. - * - * @api public - */ - -Socket.prototype.set = function (key, value, fn) { - this.store.set(key, value, fn); - return this; -}; - -/** - * Retrieves data for the client - * - * @api public - */ - -Socket.prototype.get = function (key, fn) { - this.store.get(key, fn); - return this; -}; - -/** - * Checks data for the client - * - * @api public - */ - -Socket.prototype.has = function (key, fn) { - this.store.has(key, fn); - return this; -}; - -/** - * Deletes data for the client - * - * @api public - */ - -Socket.prototype.del = function (key, fn) { - this.store.del(key, fn); - return this; -}; - -/** - * Kicks client - * - * @api public - */ - -Socket.prototype.disconnect = function () { - if (!this.disconnected) { - this.log.info('booting client'); - - if ('' === this.namespace.name) { - if (this.manager.transports[this.id] && this.manager.transports[this.id].open) { - this.manager.transports[this.id].onForcedDisconnect(); - } else { - this.manager.onClientDisconnect(this.id); - this.manager.store.publish('disconnect:' + this.id); - } - } else { - this.packet({type: 'disconnect'}); - this.manager.onLeave(this.id, this.namespace.name); - this.$emit('disconnect', 'booted'); - } - - } - - return this; -}; - -/** - * Send a message. - * - * @api public - */ - -Socket.prototype.send = function (data, fn) { - var packet = { - type: this.flags.json ? 'json' : 'message' - , data: data - }; - - if (fn) { - packet.id = ++this.ackPackets; - packet.ack = true; - this.acks[packet.id] = fn; - } - - return this.packet(packet); -}; - -/** - * Original emit function. - * - * @api private - */ - -Socket.prototype.$emit = EventEmitter.prototype.emit; - -/** - * Emit override for custom events. - * - * @api public - */ - -Socket.prototype.emit = function (ev) { - if (ev == 'newListener') { - return this.$emit.apply(this, arguments); - } - - var args = util.toArray(arguments).slice(1) - , lastArg = args[args.length - 1] - , packet = { - type: 'event' - , name: ev - }; - - if ('function' == typeof lastArg) { - packet.id = ++this.ackPackets; - packet.ack = lastArg.length ? 'data' : true; - this.acks[packet.id] = lastArg; - args = args.slice(0, args.length - 1); - } - - packet.args = args; - - return this.packet(packet); -}; diff --git a/realtime/node_modules/socket.io/lib/static.js b/realtime/node_modules/socket.io/lib/static.js deleted file mode 100644 index fe505937..00000000 --- a/realtime/node_modules/socket.io/lib/static.js +++ /dev/null @@ -1,395 +0,0 @@ - -/*! -* socket.io-node -* Copyright(c) 2011 LearnBoost -* MIT Licensed -*/ - -/** - * Module dependencies. - */ - -var client = require('socket.io-client') - , cp = require('child_process') - , fs = require('fs') - , util = require('./util'); - -/** - * File type details. - * - * @api private - */ - -var mime = { - js: { - type: 'application/javascript' - , encoding: 'utf8' - , gzip: true - } - , swf: { - type: 'application/x-shockwave-flash' - , encoding: 'binary' - , gzip: false - } -}; - -/** - * Regexp for matching custom transport patterns. Users can configure their own - * socket.io bundle based on the url structure. Different transport names are - * concatinated using the `+` char. /socket.io/socket.io+websocket.js should - * create a bundle that only contains support for the websocket. - * - * @api private - */ - -var bundle = /\+((?:\+)?[\w\-]+)*(?:\.v\d+\.\d+\.\d+)?(?:\.js)$/ - , versioning = /\.v\d+\.\d+\.\d+(?:\.js)$/; - -/** - * Export the constructor - */ - -exports = module.exports = Static; - -/** - * Static constructor - * - * @api public - */ - -function Static (manager) { - this.manager = manager; - this.cache = {}; - this.paths = {}; - - this.init(); -} - -/** - * Initialize the Static by adding default file paths. - * - * @api public - */ - -Static.prototype.init = function () { - /** - * Generates a unique id based the supplied transports array - * - * @param {Array} transports The array with transport types - * @api private - */ - function id (transports) { - var id = transports.join('').split('').map(function (char) { - return ('' + char.charCodeAt(0)).split('').pop(); - }).reduce(function (char, id) { - return char +id; - }); - - return client.version + ':' + id; - } - - /** - * Generates a socket.io-client file based on the supplied transports. - * - * @param {Array} transports The array with transport types - * @param {Function} callback Callback for the static.write - * @api private - */ - - function build (transports, callback) { - client.builder(transports, { - minify: self.manager.enabled('browser client minification') - }, function (err, content) { - callback(err, content ? new Buffer(content) : null, id(transports)); - } - ); - } - - var self = this; - - // add our default static files - this.add('/static/flashsocket/WebSocketMain.swf', { - file: client.dist + '/WebSocketMain.swf' - }); - - this.add('/static/flashsocket/WebSocketMainInsecure.swf', { - file: client.dist + '/WebSocketMainInsecure.swf' - }); - - // generates dedicated build based on the available transports - this.add('/socket.io.js', function (path, callback) { - build(self.manager.get('transports'), callback); - }); - - this.add('/socket.io.v', { mime: mime.js }, function (path, callback) { - build(self.manager.get('transports'), callback); - }); - - // allow custom builds based on url paths - this.add('/socket.io+', { mime: mime.js }, function (path, callback) { - var available = self.manager.get('transports') - , matches = path.match(bundle) - , transports = []; - - if (!matches) return callback('No valid transports'); - - // make sure they valid transports - matches[0].split('.')[0].split('+').slice(1).forEach(function (transport) { - if (!!~available.indexOf(transport)) { - transports.push(transport); - } - }); - - if (!transports.length) return callback('No valid transports'); - build(transports, callback); - }); - - // clear cache when transports change - this.manager.on('set:transports', function (key, value) { - delete self.cache['/socket.io.js']; - Object.keys(self.cache).forEach(function (key) { - if (bundle.test(key)) { - delete self.cache[key]; - } - }); - }); -}; - -/** - * Gzip compress buffers. - * - * @param {Buffer} data The buffer that needs gzip compression - * @param {Function} callback - * @api public - */ - -Static.prototype.gzip = function (data, callback) { - var gzip = cp.spawn('gzip', ['-9', '-c', '-f', '-n']) - , encoding = Buffer.isBuffer(data) ? 'binary' : 'utf8' - , buffer = [] - , err; - - gzip.stdout.on('data', function (data) { - buffer.push(data); - }); - - gzip.stderr.on('data', function (data) { - err = data +''; - buffer.length = 0; - }); - - gzip.on('close', function () { - if (err) return callback(err); - - var size = 0 - , index = 0 - , i = buffer.length - , content; - - while (i--) { - size += buffer[i].length; - } - - content = new Buffer(size); - i = buffer.length; - - buffer.forEach(function (buffer) { - var length = buffer.length; - - buffer.copy(content, index, 0, length); - index += length; - }); - - buffer.length = 0; - callback(null, content); - }); - - gzip.stdin.end(data, encoding); -}; - -/** - * Is the path a static file? - * - * @param {String} path The path that needs to be checked - * @api public - */ - -Static.prototype.has = function (path) { - // fast case - if (this.paths[path]) return this.paths[path]; - - var keys = Object.keys(this.paths) - , i = keys.length; - - while (i--) { - if (-~path.indexOf(keys[i])) return this.paths[keys[i]]; - } - - return false; -}; - -/** - * Add new paths new paths that can be served using the static provider. - * - * @param {String} path The path to respond to - * @param {Options} options Options for writing out the response - * @param {Function} [callback] Optional callback if no options.file is - * supplied this would be called instead. - * @api public - */ - -Static.prototype.add = function (path, options, callback) { - var extension = /(?:\.(\w{1,4}))$/.exec(path); - - if (!callback && typeof options == 'function') { - callback = options; - options = {}; - } - - options.mime = options.mime || (extension ? mime[extension[1]] : false); - - if (callback) options.callback = callback; - if (!(options.file || options.callback) || !options.mime) return false; - - this.paths[path] = options; - - return true; -}; - -/** - * Writes a static response. - * - * @param {String} path The path for the static content - * @param {HTTPRequest} req The request object - * @param {HTTPResponse} res The response object - * @api public - */ - -Static.prototype.write = function (path, req, res) { - /** - * Write a response without throwing errors because can throw error if the - * response is no longer writable etc. - * - * @api private - */ - - function write (status, headers, content, encoding) { - try { - res.writeHead(status, headers || undefined); - - // only write content if it's not a HEAD request and we actually have - // some content to write (304's doesn't have content). - res.end( - req.method !== 'HEAD' && content ? content : '' - , encoding || undefined - ); - } catch (e) {} - } - - /** - * Answers requests depending on the request properties and the reply object. - * - * @param {Object} reply The details and content to reply the response with - * @api private - */ - - function answer (reply) { - var cached = req.headers['if-none-match'] === reply.etag; - if (cached && self.manager.enabled('browser client etag')) { - return write(304); - } - - var accept = req.headers['accept-encoding'] || '' - , gzip = !!~accept.toLowerCase().indexOf('gzip') - , mime = reply.mime - , versioned = reply.versioned - , headers = { - 'Content-Type': mime.type - }; - - // check if we can add a etag - if (self.manager.enabled('browser client etag') && reply.etag && !versioned) { - headers['Etag'] = reply.etag; - } - - // see if we need to set Expire headers because the path is versioned - if (versioned) { - var expires = self.manager.get('browser client expires'); - headers['Cache-Control'] = 'private, x-gzip-ok="", max-age=' + expires; - headers['Date'] = new Date().toUTCString(); - headers['Expires'] = new Date(Date.now() + (expires * 1000)).toUTCString(); - } - - if (gzip && reply.gzip) { - headers['Content-Length'] = reply.gzip.length; - headers['Content-Encoding'] = 'gzip'; - headers['Vary'] = 'Accept-Encoding'; - write(200, headers, reply.gzip.content, mime.encoding); - } else { - headers['Content-Length'] = reply.length; - write(200, headers, reply.content, mime.encoding); - } - - self.manager.log.debug('served static content ' + path); - } - - var self = this - , details; - - // most common case first - if (this.manager.enabled('browser client cache') && this.cache[path]) { - return answer(this.cache[path]); - } else if (this.manager.get('browser client handler')) { - return this.manager.get('browser client handler').call(this, req, res); - } else if ((details = this.has(path))) { - /** - * A small helper function that will let us deal with fs and dynamic files - * - * @param {Object} err Optional error - * @param {Buffer} content The data - * @api private - */ - - function ready (err, content, etag) { - if (err) { - self.manager.log.warn('Unable to serve file. ' + (err.message || err)); - return write(500, null, 'Error serving static ' + path); - } - - // store the result in the cache - var reply = self.cache[path] = { - content: content - , length: content.length - , mime: details.mime - , etag: etag || client.version - , versioned: versioning.test(path) - }; - - // check if gzip is enabled - if (details.mime.gzip && self.manager.enabled('browser client gzip')) { - self.gzip(content, function (err, content) { - if (!err) { - reply.gzip = { - content: content - , length: content.length - } - } - - answer(reply); - }); - } else { - answer(reply); - } - } - - if (details.file) { - fs.readFile(details.file, ready); - } else if(details.callback) { - details.callback.call(this, path, ready); - } else { - write(404, null, 'File handle not found'); - } - } else { - write(404, null, 'File not found'); - } -}; diff --git a/realtime/node_modules/socket.io/lib/store.js b/realtime/node_modules/socket.io/lib/store.js deleted file mode 100644 index 06c0389a..00000000 --- a/realtime/node_modules/socket.io/lib/store.js +++ /dev/null @@ -1,98 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Expose the constructor. - */ - -exports = module.exports = Store; - -/** - * Module dependencies. - */ - -var EventEmitter = process.EventEmitter; - -/** - * Store interface - * - * @api public - */ - -function Store (options) { - this.options = options; - this.clients = {}; -}; - -/** - * Inherit from EventEmitter. - */ - -Store.prototype.__proto__ = EventEmitter.prototype; - -/** - * Initializes a client store - * - * @param {String} id - * @api public - */ - -Store.prototype.client = function (id) { - if (!this.clients[id]) { - this.clients[id] = new (this.constructor.Client)(this, id); - } - - return this.clients[id]; -}; - -/** - * Destroys a client - * - * @api {String} sid - * @param {Number} number of seconds to expire client data - * @api private - */ - -Store.prototype.destroyClient = function (id, expiration) { - if (this.clients[id]) { - this.clients[id].destroy(expiration); - delete this.clients[id]; - } - - return this; -}; - -/** - * Destroys the store - * - * @param {Number} number of seconds to expire client data - * @api private - */ - -Store.prototype.destroy = function (clientExpiration) { - var keys = Object.keys(this.clients) - , count = keys.length; - - for (var i = 0, l = count; i < l; i++) { - this.destroyClient(keys[i], clientExpiration); - } - - this.clients = {}; - - return this; -}; - -/** - * Client. - * - * @api public - */ - -Store.Client = function (store, id) { - this.store = store; - this.id = id; -}; diff --git a/realtime/node_modules/socket.io/lib/stores/memory.js b/realtime/node_modules/socket.io/lib/stores/memory.js deleted file mode 100644 index 8b731a79..00000000 --- a/realtime/node_modules/socket.io/lib/stores/memory.js +++ /dev/null @@ -1,143 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , Store = require('../store'); - -/** - * Exports the constructor. - */ - -exports = module.exports = Memory; -Memory.Client = Client; - -/** - * Memory store - * - * @api public - */ - -function Memory (opts) { - Store.call(this, opts); -}; - -/** - * Inherits from Store. - */ - -Memory.prototype.__proto__ = Store.prototype; - -/** - * Publishes a message. - * - * @api private - */ - -Memory.prototype.publish = function () { }; - -/** - * Subscribes to a channel - * - * @api private - */ - -Memory.prototype.subscribe = function () { }; - -/** - * Unsubscribes - * - * @api private - */ - -Memory.prototype.unsubscribe = function () { }; - -/** - * Client constructor - * - * @api private - */ - -function Client () { - Store.Client.apply(this, arguments); - this.data = {}; -}; - -/** - * Inherits from Store.Client - */ - -Client.prototype.__proto__ = Store.Client; - -/** - * Gets a key - * - * @api public - */ - -Client.prototype.get = function (key, fn) { - fn(null, this.data[key] === undefined ? null : this.data[key]); - return this; -}; - -/** - * Sets a key - * - * @api public - */ - -Client.prototype.set = function (key, value, fn) { - this.data[key] = value; - fn && fn(null); - return this; -}; - -/** - * Has a key - * - * @api public - */ - -Client.prototype.has = function (key, fn) { - fn(null, key in this.data); -}; - -/** - * Deletes a key - * - * @api public - */ - -Client.prototype.del = function (key, fn) { - delete this.data[key]; - fn && fn(null); - return this; -}; - -/** - * Destroys the client. - * - * @param {Number} number of seconds to expire data - * @api private - */ - -Client.prototype.destroy = function (expiration) { - if ('number' != typeof expiration) { - this.data = {}; - } else { - var self = this; - - setTimeout(function () { - self.data = {}; - }, expiration * 1000); - } - - return this; -}; diff --git a/realtime/node_modules/socket.io/lib/stores/redis.js b/realtime/node_modules/socket.io/lib/stores/redis.js deleted file mode 100644 index 8fea235f..00000000 --- a/realtime/node_modules/socket.io/lib/stores/redis.js +++ /dev/null @@ -1,269 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , Store = require('../store') - , assert = require('assert'); - -/** - * Exports the constructor. - */ - -exports = module.exports = Redis; -Redis.Client = Client; - -/** - * Redis store. - * Options: - * - nodeId (fn) gets an id that uniquely identifies this node - * - redis (fn) redis constructor, defaults to redis - * - redisPub (object) options to pass to the pub redis client - * - redisSub (object) options to pass to the sub redis client - * - redisClient (object) options to pass to the general redis client - * - pack (fn) custom packing, defaults to JSON or msgpack if installed - * - unpack (fn) custom packing, defaults to JSON or msgpack if installed - * - * @api public - */ - -function Redis (opts) { - opts = opts || {}; - - // node id to uniquely identify this node - var nodeId = opts.nodeId || function () { - // by default, we generate a random id - return Math.abs(Math.random() * Math.random() * Date.now() | 0); - }; - - this.nodeId = nodeId(); - - // packing / unpacking mechanism - if (opts.pack) { - this.pack = opts.pack; - this.unpack = opts.unpack; - } else { - try { - var msgpack = require('msgpack'); - this.pack = msgpack.pack; - this.unpack = msgpack.unpack; - } catch (e) { - this.pack = JSON.stringify; - this.unpack = JSON.parse; - } - } - - var redis = opts.redis || require('redis') - , RedisClient = redis.RedisClient; - - // initialize a pubsub client and a regular client - if (opts.redisPub instanceof RedisClient) { - this.pub = opts.redisPub; - } else { - opts.redisPub || (opts.redisPub = {}); - this.pub = redis.createClient(opts.redisPub.port, opts.redisPub.host, opts.redisPub); - } - if (opts.redisSub instanceof RedisClient) { - this.sub = opts.redisSub; - } else { - opts.redisSub || (opts.redisSub = {}); - this.sub = redis.createClient(opts.redisSub.port, opts.redisSub.host, opts.redisSub); - } - if (opts.redisClient instanceof RedisClient) { - this.cmd = opts.redisClient; - } else { - opts.redisClient || (opts.redisClient = {}); - this.cmd = redis.createClient(opts.redisClient.port, opts.redisClient.host, opts.redisClient); - } - - Store.call(this, opts); - - this.sub.setMaxListeners(0); - this.setMaxListeners(0); -}; - -/** - * Inherits from Store. - */ - -Redis.prototype.__proto__ = Store.prototype; - -/** - * Publishes a message. - * - * @api private - */ - -Redis.prototype.publish = function (name) { - var args = Array.prototype.slice.call(arguments, 1); - this.pub.publish(name, this.pack({ nodeId: this.nodeId, args: args })); - this.emit.apply(this, ['publish', name].concat(args)); -}; - -/** - * Subscribes to a channel - * - * @api private - */ - -Redis.prototype.subscribe = function (name, consumer, fn) { - this.sub.subscribe(name); - - if (consumer || fn) { - var self = this; - - self.sub.on('subscribe', function subscribe (ch) { - if (name == ch) { - function message (ch, msg) { - if (name == ch) { - msg = self.unpack(msg); - - // we check that the message consumed wasnt emitted by this node - if (self.nodeId != msg.nodeId) { - consumer.apply(null, msg.args); - } - } - }; - - self.sub.on('message', message); - - self.on('unsubscribe', function unsubscribe (ch) { - if (name == ch) { - self.sub.removeListener('message', message); - self.removeListener('unsubscribe', unsubscribe); - } - }); - - self.sub.removeListener('subscribe', subscribe); - - fn && fn(); - } - }); - } - - this.emit('subscribe', name, consumer, fn); -}; - -/** - * Unsubscribes - * - * @api private - */ - -Redis.prototype.unsubscribe = function (name, fn) { - this.sub.unsubscribe(name); - - if (fn) { - var client = this.sub; - - client.on('unsubscribe', function unsubscribe (ch) { - if (name == ch) { - fn(); - client.removeListener('unsubscribe', unsubscribe); - } - }); - } - - this.emit('unsubscribe', name, fn); -}; - -/** - * Destroys the store - * - * @api public - */ - -Redis.prototype.destroy = function () { - Store.prototype.destroy.call(this); - - this.pub.end(); - this.sub.end(); - this.cmd.end(); -}; - -/** - * Client constructor - * - * @api private - */ - -function Client (store, id) { - Store.Client.call(this, store, id); -}; - -/** - * Inherits from Store.Client - */ - -Client.prototype.__proto__ = Store.Client; - -/** - * Redis hash get - * - * @api private - */ - -Client.prototype.get = function (key, fn) { - this.store.cmd.hget(this.id, key, fn); - return this; -}; - -/** - * Redis hash set - * - * @api private - */ - -Client.prototype.set = function (key, value, fn) { - this.store.cmd.hset(this.id, key, value, fn); - return this; -}; - -/** - * Redis hash del - * - * @api private - */ - -Client.prototype.del = function (key, fn) { - this.store.cmd.hdel(this.id, key, fn); - return this; -}; - -/** - * Redis hash has - * - * @api private - */ - -Client.prototype.has = function (key, fn) { - this.store.cmd.hexists(this.id, key, function (err, has) { - if (err) return fn(err); - fn(null, !!has); - }); - return this; -}; - -/** - * Destroys client - * - * @param {Number} number of seconds to expire data - * @api private - */ - -Client.prototype.destroy = function (expiration) { - if ('number' != typeof expiration) { - this.store.cmd.del(this.id); - } else { - this.store.cmd.expire(this.id, expiration); - } - - return this; -}; diff --git a/realtime/node_modules/socket.io/lib/transport.js b/realtime/node_modules/socket.io/lib/transport.js deleted file mode 100644 index 2e4c08bd..00000000 --- a/realtime/node_modules/socket.io/lib/transport.js +++ /dev/null @@ -1,534 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var parser = require('./parser'); - -/** - * Expose the constructor. - */ - -exports = module.exports = Transport; - -/** - * Transport constructor. - * - * @api public - */ - -function Transport (mng, data, req) { - this.manager = mng; - this.id = data.id; - this.disconnected = false; - this.drained = true; - this.handleRequest(req); -}; - -/** - * Access the logger. - * - * @api public - */ - -Transport.prototype.__defineGetter__('log', function () { - return this.manager.log; -}); - -/** - * Access the store. - * - * @api public - */ - -Transport.prototype.__defineGetter__('store', function () { - return this.manager.store; -}); - -/** - * Handles a request when it's set. - * - * @api private - */ - -Transport.prototype.handleRequest = function (req) { - this.log.debug('setting request', req.method, req.url); - this.req = req; - - if (req.method == 'GET') { - this.socket = req.socket; - this.open = true; - this.drained = true; - this.setHeartbeatInterval(); - - this.setHandlers(); - this.onSocketConnect(); - } -}; - -/** - * Called when a connection is first set. - * - * @api private - */ - -Transport.prototype.onSocketConnect = function () { }; - -/** - * Sets transport handlers - * - * @api private - */ - -Transport.prototype.setHandlers = function () { - var self = this; - - // we need to do this in a pub/sub way since the client can POST the message - // over a different socket (ie: different Transport instance) - this.store.subscribe('heartbeat-clear:' + this.id, function () { - self.onHeartbeatClear(); - }); - - this.store.subscribe('disconnect-force:' + this.id, function () { - self.onForcedDisconnect(); - }); - - this.store.subscribe('dispatch:' + this.id, function (packet, volatile) { - self.onDispatch(packet, volatile); - }); - - this.bound = { - end: this.onSocketEnd.bind(this) - , close: this.onSocketClose.bind(this) - , error: this.onSocketError.bind(this) - , drain: this.onSocketDrain.bind(this) - }; - - this.socket.on('end', this.bound.end); - this.socket.on('close', this.bound.close); - this.socket.on('error', this.bound.error); - this.socket.on('drain', this.bound.drain); - - this.handlersSet = true; -}; - -/** - * Removes transport handlers - * - * @api private - */ - -Transport.prototype.clearHandlers = function () { - if (this.handlersSet) { - this.store.unsubscribe('disconnect-force:' + this.id); - this.store.unsubscribe('heartbeat-clear:' + this.id); - this.store.unsubscribe('dispatch:' + this.id); - - this.socket.removeListener('end', this.bound.end); - this.socket.removeListener('close', this.bound.close); - this.socket.removeListener('error', this.bound.error); - this.socket.removeListener('drain', this.bound.drain); - } -}; - -/** - * Called when the connection dies - * - * @api private - */ - -Transport.prototype.onSocketEnd = function () { - this.end('socket end'); -}; - -/** - * Called when the connection dies - * - * @api private - */ - -Transport.prototype.onSocketClose = function (error) { - this.end(error ? 'socket error' : 'socket close'); -}; - -/** - * Called when the connection has an error. - * - * @api private - */ - -Transport.prototype.onSocketError = function (err) { - if (this.open) { - this.socket.destroy(); - this.onClose(); - } - - this.log.info('socket error ' + err.stack); -}; - -/** - * Called when the connection is drained. - * - * @api private - */ - -Transport.prototype.onSocketDrain = function () { - this.drained = true; -}; - -/** - * Called upon receiving a heartbeat packet. - * - * @api private - */ - -Transport.prototype.onHeartbeatClear = function () { - this.clearHeartbeatTimeout(); - this.setHeartbeatInterval(); -}; - -/** - * Called upon a forced disconnection. - * - * @api private - */ - -Transport.prototype.onForcedDisconnect = function () { - if (!this.disconnected) { - this.log.info('transport end by forced client disconnection'); - if (this.open) { - this.packet({ type: 'disconnect' }); - } - this.end('booted'); - } -}; - -/** - * Dispatches a packet. - * - * @api private - */ - -Transport.prototype.onDispatch = function (packet, volatile) { - if (volatile) { - this.writeVolatile(packet); - } else { - this.write(packet); - } -}; - -/** - * Sets the close timeout. - */ - -Transport.prototype.setCloseTimeout = function () { - if (!this.closeTimeout) { - var self = this; - - this.closeTimeout = setTimeout(function () { - self.log.debug('fired close timeout for client', self.id); - self.closeTimeout = null; - self.end('close timeout'); - }, this.manager.get('close timeout') * 1000); - - this.log.debug('set close timeout for client', this.id); - } -}; - -/** - * Clears the close timeout. - */ - -Transport.prototype.clearCloseTimeout = function () { - if (this.closeTimeout) { - clearTimeout(this.closeTimeout); - this.closeTimeout = null; - - this.log.debug('cleared close timeout for client', this.id); - } -}; - -/** - * Sets the heartbeat timeout - */ - -Transport.prototype.setHeartbeatTimeout = function () { - if (!this.heartbeatTimeout && this.manager.enabled('heartbeats')) { - var self = this; - - this.heartbeatTimeout = setTimeout(function () { - self.log.debug('fired heartbeat timeout for client', self.id); - self.heartbeatTimeout = null; - self.end('heartbeat timeout'); - }, this.manager.get('heartbeat timeout') * 1000); - - this.log.debug('set heartbeat timeout for client', this.id); - } -}; - -/** - * Clears the heartbeat timeout - * - * @param text - */ - -Transport.prototype.clearHeartbeatTimeout = function () { - if (this.heartbeatTimeout && this.manager.enabled('heartbeats')) { - clearTimeout(this.heartbeatTimeout); - this.heartbeatTimeout = null; - this.log.debug('cleared heartbeat timeout for client', this.id); - } -}; - -/** - * Sets the heartbeat interval. To be called when a connection opens and when - * a heartbeat is received. - * - * @api private - */ - -Transport.prototype.setHeartbeatInterval = function () { - if (!this.heartbeatInterval && this.manager.enabled('heartbeats')) { - var self = this; - - this.heartbeatInterval = setTimeout(function () { - self.heartbeat(); - self.heartbeatInterval = null; - }, this.manager.get('heartbeat interval') * 1000); - - this.log.debug('set heartbeat interval for client', this.id); - } -}; - -/** - * Clears all timeouts. - * - * @api private - */ - -Transport.prototype.clearTimeouts = function () { - this.clearCloseTimeout(); - this.clearHeartbeatTimeout(); - this.clearHeartbeatInterval(); -}; - -/** - * Sends a heartbeat - * - * @api private - */ - -Transport.prototype.heartbeat = function () { - if (this.open) { - this.log.debug('emitting heartbeat for client', this.id); - this.packet({ type: 'heartbeat' }); - this.setHeartbeatTimeout(); - } - - return this; -}; - -/** - * Handles a message. - * - * @param {Object} packet object - * @api private - */ - -Transport.prototype.onMessage = function (packet) { - var current = this.manager.transports[this.id]; - - if ('heartbeat' == packet.type) { - this.log.debug('got heartbeat packet'); - - if (current && current.open) { - current.onHeartbeatClear(); - } else { - this.store.publish('heartbeat-clear:' + this.id); - } - } else { - if ('disconnect' == packet.type && packet.endpoint == '') { - this.log.debug('got disconnection packet'); - - if (current) { - current.onForcedDisconnect(); - } else { - this.store.publish('disconnect-force:' + this.id); - } - - return; - } - - if (packet.id && packet.ack != 'data') { - this.log.debug('acknowledging packet automatically'); - - var ack = parser.encodePacket({ - type: 'ack' - , ackId: packet.id - , endpoint: packet.endpoint || '' - }); - - if (current && current.open) { - current.onDispatch(ack); - } else { - this.manager.onClientDispatch(this.id, ack); - this.store.publish('dispatch:' + this.id, ack); - } - } - - // handle packet locally or publish it - if (current) { - this.manager.onClientMessage(this.id, packet); - } else { - this.store.publish('message:' + this.id, packet); - } - } -}; - -/** - * Clears the heartbeat interval - * - * @api private - */ - -Transport.prototype.clearHeartbeatInterval = function () { - if (this.heartbeatInterval && this.manager.enabled('heartbeats')) { - clearTimeout(this.heartbeatInterval); - this.heartbeatInterval = null; - this.log.debug('cleared heartbeat interval for client', this.id); - } -}; - -/** - * Finishes the connection and makes sure client doesn't reopen - * - * @api private - */ - -Transport.prototype.disconnect = function (reason) { - this.packet({ type: 'disconnect' }); - this.end(reason); - - return this; -}; - -/** - * Closes the connection. - * - * @api private - */ - -Transport.prototype.close = function () { - if (this.open) { - this.doClose(); - this.onClose(); - } -}; - -/** - * Called upon a connection close. - * - * @api private - */ - -Transport.prototype.onClose = function () { - if (this.open) { - this.setCloseTimeout(); - this.clearHandlers(); - this.open = false; - this.manager.onClose(this.id); - this.store.publish('close', this.id); - } -}; - -/** - * Cleans up the connection, considers the client disconnected. - * - * @api private - */ - -Transport.prototype.end = function (reason) { - if (!this.disconnected) { - this.log.info('transport end (' + reason + ')'); - - var local = this.manager.transports[this.id]; - - this.close(); - this.clearTimeouts(); - this.disconnected = true; - - if (local) { - this.manager.onClientDisconnect(this.id, reason, true); - } else { - this.store.publish('disconnect:' + this.id, reason); - } - } -}; - -/** - * Signals that the transport should pause and buffer data. - * - * @api public - */ - -Transport.prototype.discard = function () { - this.log.debug('discarding transport'); - this.discarded = true; - this.clearTimeouts(); - this.clearHandlers(); - - return this; -}; - -/** - * Writes an error packet with the specified reason and advice. - * - * @param {Number} advice - * @param {Number} reason - * @api public - */ - -Transport.prototype.error = function (reason, advice) { - this.packet({ - type: 'error' - , reason: reason - , advice: advice - }); - - this.log.warn(reason, advice ? ('client should ' + advice) : ''); - this.end('error'); -}; - -/** - * Write a packet. - * - * @api public - */ - -Transport.prototype.packet = function (obj) { - return this.write(parser.encodePacket(obj)); -}; - -/** - * Writes a volatile message. - * - * @api private - */ - -Transport.prototype.writeVolatile = function (msg) { - if (this.open) { - if (this.drained) { - this.write(msg); - } else { - this.log.debug('ignoring volatile packet, buffer not drained'); - } - } else { - this.log.debug('ignoring volatile packet, transport not open'); - } -}; diff --git a/realtime/node_modules/socket.io/lib/transports/flashsocket.js b/realtime/node_modules/socket.io/lib/transports/flashsocket.js deleted file mode 100644 index dc2d78b4..00000000 --- a/realtime/node_modules/socket.io/lib/transports/flashsocket.js +++ /dev/null @@ -1,129 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ -var WebSocket = require('./websocket'); - -/** - * Export the constructor. - */ - -exports = module.exports = FlashSocket; - -/** - * The FlashSocket transport is just a proxy - * for WebSocket connections. - * - * @api public - */ - -function FlashSocket (mng, data, req) { - return WebSocket.call(this, mng, data, req); -} - -/** - * Inherits from WebSocket. - */ - -FlashSocket.prototype.__proto__ = WebSocket.prototype; - -/** - * Transport name - * - * @api public - */ - -FlashSocket.prototype.name = 'flashsocket'; - -/** - * Listens for new configuration changes of the Manager - * this way we can enable and disable the flash server. - * - * @param {Manager} Manager instance. - * @api private - */ - - -FlashSocket.init = function (manager) { - var server; - function create () { - - // Drop out immediately if the user has - // disabled the flash policy server - if (!manager.get('flash policy server')) { - return; - } - - server = require('policyfile').createServer({ - log: function(msg){ - manager.log.info(msg); - } - }, manager.get('origins')); - - server.on('close', function (e) { - server = null; - }); - - server.listen(manager.get('flash policy port'), manager.server); - - manager.flashPolicyServer = server; - } - - // listen for origin changes, so we can update the server - manager.on('set:origins', function (value, key) { - if (!server) return; - - // update the origins and compile a new response buffer - server.origins = Array.isArray(value) ? value : [value]; - server.compile(); - }); - - // destory the server and create a new server - manager.on('set:flash policy port', function (value, key) { - var transports = manager.get('transports'); - if (~transports.indexOf('flashsocket')) { - if (server) { - if (server.port === value) return; - // destroy the server and rebuild it on a new port - try { - server.close(); - } - catch (e) { /* ignore exception. could e.g. be that the server isn't started yet */ } - } - create(); - } - }); - - // create or destroy the server - manager.on('set:flash policy server', function (value, key) { - var transports = manager.get('transports'); - if (~transports.indexOf('flashsocket')) { - if (server && !value) { - // destroy the server - try { - server.close(); - } - catch (e) { /* ignore exception. could e.g. be that the server isn't started yet */ } - } - } else if (!server && value) { - // create the server - create(); - } - }); - - // only start the server - manager.on('set:transports', function (value, key){ - if (!server && ~manager.get('transports').indexOf('flashsocket')) { - create(); - } - }); - // check if we need to initialize at start - if (~manager.get('transports').indexOf('flashsocket')){ - create(); - } -}; diff --git a/realtime/node_modules/socket.io/lib/transports/htmlfile.js b/realtime/node_modules/socket.io/lib/transports/htmlfile.js deleted file mode 100644 index e8709a31..00000000 --- a/realtime/node_modules/socket.io/lib/transports/htmlfile.js +++ /dev/null @@ -1,82 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPTransport = require('./http'); - -/** - * Export the constructor. - */ - -exports = module.exports = HTMLFile; - -/** - * HTMLFile transport constructor. - * - * @api public - */ - -function HTMLFile (mng, data, req) { - HTTPTransport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -HTMLFile.prototype.__proto__ = HTTPTransport.prototype; - -/** - * Transport name - * - * @api public - */ - -HTMLFile.prototype.name = 'htmlfile'; - -/** - * Handles the request. - * - * @api private - */ - -HTMLFile.prototype.handleRequest = function (req) { - HTTPTransport.prototype.handleRequest.call(this, req); - - if (req.method == 'GET') { - req.res.writeHead(200, { - 'Content-Type': 'text/html; charset=UTF-8' - , 'Connection': 'keep-alive' - , 'Transfer-Encoding': 'chunked' - }); - - req.res.write( - '' - + '' - + new Array(174).join(' ') - ); - } -}; - -/** - * Performs the write. - * - * @api private - */ - -HTMLFile.prototype.write = function (data) { - data = ''; - - if (this.response.write(data)) { - this.drained = true; - } - - this.log.debug(this.name + ' writing', data); -}; diff --git a/realtime/node_modules/socket.io/lib/transports/http-polling.js b/realtime/node_modules/socket.io/lib/transports/http-polling.js deleted file mode 100644 index 89b7e042..00000000 --- a/realtime/node_modules/socket.io/lib/transports/http-polling.js +++ /dev/null @@ -1,147 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPTransport = require('./http'); - -/** - * Exports the constructor. - */ - -exports = module.exports = HTTPPolling; - -/** - * HTTP polling constructor. - * - * @api public. - */ - -function HTTPPolling (mng, data, req) { - HTTPTransport.call(this, mng, data, req); -}; - -/** - * Inherits from HTTPTransport. - * - * @api public. - */ - -HTTPPolling.prototype.__proto__ = HTTPTransport.prototype; - -/** - * Transport name - * - * @api public - */ - -HTTPPolling.prototype.name = 'httppolling'; - -/** - * Override setHandlers - * - * @api private - */ - -HTTPPolling.prototype.setHandlers = function () { - HTTPTransport.prototype.setHandlers.call(this); - this.socket.removeListener('end', this.bound.end); - this.socket.removeListener('close', this.bound.close); -}; - -/** - * Removes heartbeat timeouts for polling. - */ - -HTTPPolling.prototype.setHeartbeatInterval = function () { - return this; -}; - -/** - * Handles a request - * - * @api private - */ - -HTTPPolling.prototype.handleRequest = function (req) { - HTTPTransport.prototype.handleRequest.call(this, req); - - if (req.method == 'GET') { - var self = this; - - this.pollTimeout = setTimeout(function () { - self.packet({ type: 'noop' }); - self.log.debug(self.name + ' closed due to exceeded duration'); - }, this.manager.get('polling duration') * 1000); - - this.log.debug('setting poll timeout'); - } -}; - -/** - * Clears polling timeout - * - * @api private - */ - -HTTPPolling.prototype.clearPollTimeout = function () { - if (this.pollTimeout) { - clearTimeout(this.pollTimeout); - this.pollTimeout = null; - this.log.debug('clearing poll timeout'); - } - - return this; -}; - -/** - * Override clear timeouts to clear the poll timeout - * - * @api private - */ - -HTTPPolling.prototype.clearTimeouts = function () { - HTTPTransport.prototype.clearTimeouts.call(this); - - this.clearPollTimeout(); -}; - -/** - * doWrite to clear poll timeout - * - * @api private - */ - -HTTPPolling.prototype.doWrite = function () { - this.clearPollTimeout(); -}; - -/** - * Performs a write. - * - * @api private. - */ - -HTTPPolling.prototype.write = function (data, close) { - this.doWrite(data); - this.response.end(); - this.onClose(); -}; - -/** - * Override end. - * - * @api private - */ - -HTTPPolling.prototype.end = function (reason) { - this.clearPollTimeout(); - return HTTPTransport.prototype.end.call(this, reason); -}; - diff --git a/realtime/node_modules/socket.io/lib/transports/http.js b/realtime/node_modules/socket.io/lib/transports/http.js deleted file mode 100644 index 28db794d..00000000 --- a/realtime/node_modules/socket.io/lib/transports/http.js +++ /dev/null @@ -1,121 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../transport') - , parser = require('../parser') - , qs = require('querystring'); - -/** - * Export the constructor. - */ - -exports = module.exports = HTTPTransport; - -/** - * HTTP interface constructor. For all non-websocket transports. - * - * @api public - */ - -function HTTPTransport (mng, data, req) { - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -HTTPTransport.prototype.__proto__ = Transport.prototype; - -/** - * Handles a request. - * - * @api private - */ - -HTTPTransport.prototype.handleRequest = function (req) { - - // Always set the response in case an error is returned to the client - this.response = req.res; - - if (req.method == 'POST') { - var buffer = '' - , res = req.res - , origin = req.headers.origin - , headers = { 'Content-Length': 1, 'Content-Type': 'text/plain; charset=UTF-8' } - , self = this; - - req.on('data', function (data) { - buffer += data; - - if (Buffer.byteLength(buffer) >= self.manager.get('destroy buffer size')) { - buffer = ''; - req.connection.destroy(); - } - }); - - req.on('end', function () { - res.writeHead(200, headers); - res.end('1'); - - self.onData(self.postEncoded ? qs.parse(buffer).d : buffer); - }); - - // prevent memory leaks for uncompleted requests - req.on('close', function () { - buffer = ''; - self.onClose(); - }); - - if (origin) { - // https://developer.mozilla.org/En/HTTP_Access_Control - headers['Access-Control-Allow-Origin'] = origin; - headers['Access-Control-Allow-Credentials'] = 'true'; - } - } else { - Transport.prototype.handleRequest.call(this, req); - } -}; - -/** - * Handles data payload. - * - * @api private - */ - -HTTPTransport.prototype.onData = function (data) { - var messages = parser.decodePayload(data); - this.log.debug(this.name + ' received data packet', data); - - for (var i = 0, l = messages.length; i < l; i++) { - this.onMessage(messages[i]); - } -}; - -/** - * Closes the request-response cycle - * - * @api private - */ - -HTTPTransport.prototype.doClose = function () { - this.response.end(); -}; - -/** - * Writes a payload of messages - * - * @api private - */ - -HTTPTransport.prototype.payload = function (msgs) { - this.write(parser.encodePayload(msgs)); -}; diff --git a/realtime/node_modules/socket.io/lib/transports/index.js b/realtime/node_modules/socket.io/lib/transports/index.js deleted file mode 100644 index b8655594..00000000 --- a/realtime/node_modules/socket.io/lib/transports/index.js +++ /dev/null @@ -1,12 +0,0 @@ - -/** - * Export transports. - */ - -module.exports = { - websocket: require('./websocket') - , flashsocket: require('./flashsocket') - , htmlfile: require('./htmlfile') - , 'xhr-polling': require('./xhr-polling') - , 'jsonp-polling': require('./jsonp-polling') -}; diff --git a/realtime/node_modules/socket.io/lib/transports/jsonp-polling.js b/realtime/node_modules/socket.io/lib/transports/jsonp-polling.js deleted file mode 100644 index ad7d5aff..00000000 --- a/realtime/node_modules/socket.io/lib/transports/jsonp-polling.js +++ /dev/null @@ -1,97 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPPolling = require('./http-polling'); -var jsonpolling_re = /^\d+$/ - -/** - * Export the constructor. - */ - -exports = module.exports = JSONPPolling; - -/** - * JSON-P polling transport. - * - * @api public - */ - -function JSONPPolling (mng, data, req) { - HTTPPolling.call(this, mng, data, req); - - this.head = 'io.j[0]('; - this.foot = ');'; - - if (data.query.i && jsonpolling_re.test(data.query.i)) { - this.head = 'io.j[' + data.query.i + ']('; - } -}; - -/** - * Inherits from Transport. - */ - -JSONPPolling.prototype.__proto__ = HTTPPolling.prototype; - -/** - * Transport name - * - * @api public - */ - -JSONPPolling.prototype.name = 'jsonppolling'; - -/** - * Make sure POST are decoded. - */ - -JSONPPolling.prototype.postEncoded = true; - -/** - * Handles incoming data. - * Due to a bug in \n handling by browsers, we expect a JSONified string. - * - * @api private - */ - -JSONPPolling.prototype.onData = function (data) { - try { - data = JSON.parse(data); - } catch (e) { - this.error('parse', 'reconnect'); - return; - } - - HTTPPolling.prototype.onData.call(this, data); -}; - -/** - * Performs the write. - * - * @api private - */ - -JSONPPolling.prototype.doWrite = function (data) { - HTTPPolling.prototype.doWrite.call(this); - - var data = data === undefined - ? '' : this.head + JSON.stringify(data) + this.foot; - - this.response.writeHead(200, { - 'Content-Type': 'text/javascript; charset=UTF-8' - , 'Content-Length': Buffer.byteLength(data) - , 'Connection': 'Keep-Alive' - , 'X-XSS-Protection': '0' - }); - - this.response.write(data); - this.log.debug(this.name + ' writing', data); -}; diff --git a/realtime/node_modules/socket.io/lib/transports/websocket.js b/realtime/node_modules/socket.io/lib/transports/websocket.js deleted file mode 100644 index 78a43043..00000000 --- a/realtime/node_modules/socket.io/lib/transports/websocket.js +++ /dev/null @@ -1,36 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var protocolVersions = require('./websocket/'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - var transport - , version = req.headers['sec-websocket-version']; - if (typeof version !== 'undefined' && typeof protocolVersions[version] !== 'undefined') { - transport = new protocolVersions[version](mng, data, req); - } - else transport = new protocolVersions['default'](mng, data, req); - if (typeof this.name !== 'undefined') transport.name = this.name; - return transport; -}; diff --git a/realtime/node_modules/socket.io/lib/transports/websocket/default.js b/realtime/node_modules/socket.io/lib/transports/websocket/default.js deleted file mode 100644 index 091fdd44..00000000 --- a/realtime/node_modules/socket.io/lib/transports/websocket/default.js +++ /dev/null @@ -1,362 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../../transport') - , EventEmitter = process.EventEmitter - , crypto = require('crypto') - , parser = require('../../parser'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - // parser - var self = this; - - this.parser = new Parser(); - this.parser.on('data', function (packet) { - self.log.debug(self.name + ' received data packet', packet); - self.onMessage(parser.decodePacket(packet)); - }); - this.parser.on('close', function () { - self.end(); - }); - this.parser.on('error', function () { - self.end(); - }); - - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -WebSocket.prototype.__proto__ = Transport.prototype; - -/** - * Transport name - * - * @api public - */ - -WebSocket.prototype.name = 'websocket'; - -/** - * Websocket draft version - * - * @api public - */ - -WebSocket.prototype.protocolVersion = 'hixie-76'; - -/** - * Called when the socket connects. - * - * @api private - */ - -WebSocket.prototype.onSocketConnect = function () { - var self = this; - - this.socket.setNoDelay(true); - - this.buffer = true; - this.buffered = []; - - if (this.req.headers.upgrade !== 'WebSocket') { - this.log.warn(this.name + ' connection invalid'); - this.end(); - return; - } - - var origin = this.req.headers['origin'] - , waitingForNonce = false; - if(this.manager.settings['match origin protocol']){ - location = (origin.indexOf('https')>-1 ? 'wss' : 'ws') + '://' + this.req.headers.host + this.req.url; - }else if(this.socket.encrypted){ - location = 'wss://' + this.req.headers.host + this.req.url; - }else{ - location = 'ws://' + this.req.headers.host + this.req.url; - } - - if (this.req.headers['sec-websocket-key1']) { - // If we don't have the nonce yet, wait for it (HAProxy compatibility). - if (! (this.req.head && this.req.head.length >= 8)) { - waitingForNonce = true; - } - - var headers = [ - 'HTTP/1.1 101 WebSocket Protocol Handshake' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Origin: ' + origin - , 'Sec-WebSocket-Location: ' + location - ]; - - if (this.req.headers['sec-websocket-protocol']){ - headers.push('Sec-WebSocket-Protocol: ' - + this.req.headers['sec-websocket-protocol']); - } - } else { - var headers = [ - 'HTTP/1.1 101 Web Socket Protocol Handshake' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'WebSocket-Origin: ' + origin - , 'WebSocket-Location: ' + location - ]; - } - - try { - this.socket.write(headers.concat('', '').join('\r\n')); - this.socket.setTimeout(0); - this.socket.setNoDelay(true); - this.socket.setEncoding('utf8'); - } catch (e) { - this.end(); - return; - } - - if (waitingForNonce) { - this.socket.setEncoding('binary'); - } else if (this.proveReception(headers)) { - self.flush(); - } - - var headBuffer = ''; - - this.socket.on('data', function (data) { - if (waitingForNonce) { - headBuffer += data; - - if (headBuffer.length < 8) { - return; - } - - // Restore the connection to utf8 encoding after receiving the nonce - self.socket.setEncoding('utf8'); - waitingForNonce = false; - - // Stuff the nonce into the location where it's expected to be - self.req.head = headBuffer.substr(0, 8); - headBuffer = ''; - - if (self.proveReception(headers)) { - self.flush(); - } - - return; - } - - self.parser.add(data); - }); -}; - -/** - * Writes to the socket. - * - * @api private - */ - -WebSocket.prototype.write = function (data) { - if (this.open) { - this.drained = false; - - if (this.buffer) { - this.buffered.push(data); - return this; - } - - var length = Buffer.byteLength(data) - , buffer = new Buffer(2 + length); - - buffer.write('\x00', 'binary'); - buffer.write(data, 1, 'utf8'); - buffer.write('\xff', 1 + length, 'binary'); - - try { - if (this.socket.write(buffer)) { - this.drained = true; - } - } catch (e) { - this.end(); - } - - this.log.debug(this.name + ' writing', data); - } -}; - -/** - * Flushes the internal buffer - * - * @api private - */ - -WebSocket.prototype.flush = function () { - this.buffer = false; - - for (var i = 0, l = this.buffered.length; i < l; i++) { - this.write(this.buffered.splice(0, 1)[0]); - } -}; - -/** - * Finishes the handshake. - * - * @api private - */ - -WebSocket.prototype.proveReception = function (headers) { - var self = this - , k1 = this.req.headers['sec-websocket-key1'] - , k2 = this.req.headers['sec-websocket-key2']; - - if (k1 && k2){ - var md5 = crypto.createHash('md5'); - - [k1, k2].forEach(function (k) { - var n = parseInt(k.replace(/[^\d]/g, '')) - , spaces = k.replace(/[^ ]/g, '').length; - - if (spaces === 0 || n % spaces !== 0){ - self.log.warn('Invalid ' + self.name + ' key: "' + k + '".'); - self.end(); - return false; - } - - n /= spaces; - - md5.update(String.fromCharCode( - n >> 24 & 0xFF, - n >> 16 & 0xFF, - n >> 8 & 0xFF, - n & 0xFF)); - }); - - md5.update(this.req.head.toString('binary')); - - try { - this.socket.write(md5.digest('binary'), 'binary'); - } catch (e) { - this.end(); - } - } - - return true; -}; - -/** - * Writes a payload. - * - * @api private - */ - -WebSocket.prototype.payload = function (msgs) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.write(msgs[i]); - } - - return this; -}; - -/** - * Closes the connection. - * - * @api private - */ - -WebSocket.prototype.doClose = function () { - this.socket.end(); -}; - -/** - * WebSocket parser - * - * @api public - */ - -function Parser () { - this.buffer = ''; - this.i = 0; -}; - -/** - * Inherits from EventEmitter. - */ - -Parser.prototype.__proto__ = EventEmitter.prototype; - -/** - * Adds data to the buffer. - * - * @api public - */ - -Parser.prototype.add = function (data) { - this.buffer += data; - this.parse(); -}; - -/** - * Parses the buffer. - * - * @api private - */ - -Parser.prototype.parse = function () { - for (var i = this.i, chr, l = this.buffer.length; i < l; i++){ - chr = this.buffer[i]; - - if (this.buffer.length == 2 && this.buffer[1] == '\u0000') { - this.emit('close'); - this.buffer = ''; - this.i = 0; - return; - } - - if (i === 0){ - if (chr != '\u0000') - this.error('Bad framing. Expected null byte as first frame'); - else - continue; - } - - if (chr == '\ufffd'){ - this.emit('data', this.buffer.substr(1, i - 1)); - this.buffer = this.buffer.substr(i + 1); - this.i = 0; - return this.parse(); - } - } -}; - -/** - * Handles an error - * - * @api private - */ - -Parser.prototype.error = function (reason) { - this.buffer = ''; - this.i = 0; - this.emit('error', reason); - return this; -}; diff --git a/realtime/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js b/realtime/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js deleted file mode 100644 index 44f666a5..00000000 --- a/realtime/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js +++ /dev/null @@ -1,622 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../../transport') - , EventEmitter = process.EventEmitter - , crypto = require('crypto') - , url = require('url') - , parser = require('../../parser') - , util = require('../../util'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; -exports.Parser = Parser; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - // parser - var self = this; - - this.manager = mng; - this.parser = new Parser(); - this.parser.on('data', function (packet) { - self.onMessage(parser.decodePacket(packet)); - }); - this.parser.on('ping', function () { - // version 8 ping => pong - try { - self.socket.write('\u008a\u0000'); - } - catch (e) { - self.end(); - return; - } - }); - this.parser.on('close', function () { - self.end(); - }); - this.parser.on('error', function (reason) { - self.log.warn(self.name + ' parser error: ' + reason); - self.end(); - }); - - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -WebSocket.prototype.__proto__ = Transport.prototype; - -/** - * Transport name - * - * @api public - */ - -WebSocket.prototype.name = 'websocket'; - -/** - * Websocket draft version - * - * @api public - */ - -WebSocket.prototype.protocolVersion = '07-12'; - -/** - * Called when the socket connects. - * - * @api private - */ - -WebSocket.prototype.onSocketConnect = function () { - var self = this; - - if (typeof this.req.headers.upgrade === 'undefined' || - this.req.headers.upgrade.toLowerCase() !== 'websocket') { - this.log.warn(this.name + ' connection invalid'); - this.end(); - return; - } - - var origin = this.req.headers['sec-websocket-origin'] - , location = ((this.manager.settings['match origin protocol'] ? - origin.match(/^https/) : this.socket.encrypted) ? - 'wss' : 'ws') - + '://' + this.req.headers.host + this.req.url; - - if (!this.verifyOrigin(origin)) { - this.log.warn(this.name + ' connection invalid: origin mismatch'); - this.end(); - return; - } - - if (!this.req.headers['sec-websocket-key']) { - this.log.warn(this.name + ' connection invalid: received no key'); - this.end(); - return; - } - - // calc key - var key = this.req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - try { - this.socket.write(headers.concat('', '').join('\r\n')); - this.socket.setTimeout(0); - this.socket.setNoDelay(true); - } catch (e) { - this.end(); - return; - } - - this.socket.on('data', function (data) { - self.parser.add(data); - }); -}; - -/** - * Verifies the origin of a request. - * - * @api private - */ - -WebSocket.prototype.verifyOrigin = function (origin) { - var origins = this.manager.get('origins'); - - if (origin === 'null') origin = '*'; - - if (origins.indexOf('*:*') !== -1) { - return true; - } - - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~origins.indexOf(parts.hostname + ':' + parts.port) || - ~origins.indexOf(parts.hostname + ':*') || - ~origins.indexOf('*:' + parts.port); - if (!ok) this.log.warn('illegal origin: ' + origin); - return ok; - } catch (ex) { - this.log.warn('error parsing origin'); - } - } - else { - this.log.warn('origin missing from websocket call, yet required by config'); - } - return false; -}; - -/** - * Writes to the socket. - * - * @api private - */ - -WebSocket.prototype.write = function (data) { - if (this.open) { - var buf = this.frame(0x81, data); - try { - this.socket.write(buf, 'binary'); - } - catch (e) { - this.end(); - return; - } - this.log.debug(this.name + ' writing', data); - } -}; - -/** - * Writes a payload. - * - * @api private - */ - -WebSocket.prototype.payload = function (msgs) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.write(msgs[i]); - } - - return this; -}; - -/** - * Frame server-to-client output as a text packet. - * - * @api private - */ - -WebSocket.prototype.frame = function (opcode, str) { - var dataBuffer = new Buffer(str) - , dataLength = dataBuffer.length - , startOffset = 2 - , secondByte = dataLength; - if (dataLength > 65536) { - startOffset = 10; - secondByte = 127; - } - else if (dataLength > 125) { - startOffset = 4; - secondByte = 126; - } - var outputBuffer = new Buffer(dataLength + startOffset); - outputBuffer[0] = opcode; - outputBuffer[1] = secondByte; - dataBuffer.copy(outputBuffer, startOffset); - switch (secondByte) { - case 126: - outputBuffer[2] = dataLength >>> 8; - outputBuffer[3] = dataLength % 256; - break; - case 127: - var l = dataLength; - for (var i = 1; i <= 8; ++i) { - outputBuffer[startOffset - i] = l & 0xff; - l >>>= 8; - } - } - return outputBuffer; -}; - -/** - * Closes the connection. - * - * @api private - */ - -WebSocket.prototype.doClose = function () { - this.socket.end(); -}; - -/** - * WebSocket parser - * - * @api public - */ - -function Parser () { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.overflow = null; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = ''; - - var self = this; - this.opcodeHandlers = { - // text - '1': function(data) { - var finish = function(mask, data) { - self.currentMessage += self.unmask(mask, data); - if (self.state.lastFragment) { - self.emit('data', self.currentMessage); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // binary - '2': function(data) { - var finish = function(mask, data) { - if (typeof self.currentMessage == 'string') self.currentMessage = []; // build a buffer list - self.currentMessage.push(self.unmask(mask, data, true)); - if (self.state.lastFragment) { - self.emit('binary', self.concatBuffers(self.currentMessage)); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // close - '8': function(data) { - self.emit('close'); - self.reset(); - }, - // ping - '9': function(data) { - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported'); - return; - } - - var finish = function(mask, data) { - self.emit('ping', self.unmask(mask, data)); - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength == 0) { - finish(null, null); - } - else if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - expectData(util.unpack(data)); - }); - } - } - } - - this.expect('Opcode', 2, this.processPacket); -}; - -/** - * Inherits from EventEmitter. - */ - -Parser.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add new data to the parser. - * - * @api public - */ - -Parser.prototype.add = function(data) { - if (this.expectBuffer == null) { - this.addToOverflow(data); - return; - } - var toRead = Math.min(data.length, this.expectBuffer.length - this.expectOffset); - data.copy(this.expectBuffer, this.expectOffset, 0, toRead); - this.expectOffset += toRead; - if (toRead < data.length) { - // at this point the overflow buffer shouldn't at all exist - this.overflow = new Buffer(data.length - toRead); - data.copy(this.overflow, 0, toRead, toRead + this.overflow.length); - } - if (this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } -} - -/** - * Adds a piece of data to the overflow. - * - * @api private - */ - -Parser.prototype.addToOverflow = function(data) { - if (this.overflow == null) this.overflow = data; - else { - var prevOverflow = this.overflow; - this.overflow = new Buffer(this.overflow.length + data.length); - prevOverflow.copy(this.overflow, 0); - data.copy(this.overflow, prevOverflow.length); - } -} - -/** - * Waits for a certain amount of bytes to be available, then fires a callback. - * - * @api private - */ - -Parser.prototype.expect = function(what, length, handler) { - this.expectBuffer = new Buffer(length); - this.expectOffset = 0; - this.expectHandler = handler; - if (this.overflow != null) { - var toOverflow = this.overflow; - this.overflow = null; - this.add(toOverflow); - } -} - -/** - * Start processing a new packet. - * - * @api private - */ - -Parser.prototype.processPacket = function (data) { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty'); - } - this.state.lastFragment = (data[0] & 0x80) == 0x80; - this.state.masked = (data[1] & 0x80) == 0x80; - var opcode = data[0] & 0xf; - if (opcode == 0) { - // continuation frame - this.state.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode') - return; - } - } - else { - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.activeFragmentedOperation = opcode; - } - } - var handler = this.opcodeHandlers[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode); - else handler(data); -} - -/** - * Endprocessing a packet. - * - * @api private - */ - -Parser.prototype.endPacket = function() { - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - if (this.state.lastFragment && this.state.opcode == this.state.activeFragmentedOperation) { - // end current fragmented operation - this.state.activeFragmentedOperation = null; - } - this.state.lastFragment = false; - this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; - this.state.masked = false; - this.expect('Opcode', 2, this.processPacket); -} - -/** - * Reset the parser state. - * - * @api private - */ - -Parser.prototype.reset = function() { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = null; - this.currentMessage = ''; -} - -/** - * Unmask received data. - * - * @api private - */ - -Parser.prototype.unmask = function (mask, buf, binary) { - if (mask != null) { - for (var i = 0, ll = buf.length; i < ll; i++) { - buf[i] ^= mask[i % 4]; - } - } - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; -} - -/** - * Concatenates a list of buffers. - * - * @api private - */ - -Parser.prototype.concatBuffers = function(buffers) { - var length = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - length += buffers[i].length; - } - var mergedBuffer = new Buffer(length); - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - buffers[i].copy(mergedBuffer, offset); - offset += buffers[i].length; - } - return mergedBuffer; -} - -/** - * Handles an error - * - * @api private - */ - -Parser.prototype.error = function (reason) { - this.reset(); - this.emit('error', reason); - return this; -}; diff --git a/realtime/node_modules/socket.io/lib/transports/websocket/hybi-16.js b/realtime/node_modules/socket.io/lib/transports/websocket/hybi-16.js deleted file mode 100644 index 69967dad..00000000 --- a/realtime/node_modules/socket.io/lib/transports/websocket/hybi-16.js +++ /dev/null @@ -1,622 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../../transport') - , EventEmitter = process.EventEmitter - , crypto = require('crypto') - , url = require('url') - , parser = require('../../parser') - , util = require('../../util'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; -exports.Parser = Parser; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - // parser - var self = this; - - this.manager = mng; - this.parser = new Parser(); - this.parser.on('data', function (packet) { - self.onMessage(parser.decodePacket(packet)); - }); - this.parser.on('ping', function () { - // version 8 ping => pong - try { - self.socket.write('\u008a\u0000'); - } - catch (e) { - self.end(); - return; - } - }); - this.parser.on('close', function () { - self.end(); - }); - this.parser.on('error', function (reason) { - self.log.warn(self.name + ' parser error: ' + reason); - self.end(); - }); - - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -WebSocket.prototype.__proto__ = Transport.prototype; - -/** - * Transport name - * - * @api public - */ - -WebSocket.prototype.name = 'websocket'; - -/** - * Websocket draft version - * - * @api public - */ - -WebSocket.prototype.protocolVersion = '16'; - -/** - * Called when the socket connects. - * - * @api private - */ - -WebSocket.prototype.onSocketConnect = function () { - var self = this; - - if (typeof this.req.headers.upgrade === 'undefined' || - this.req.headers.upgrade.toLowerCase() !== 'websocket') { - this.log.warn(this.name + ' connection invalid'); - this.end(); - return; - } - - var origin = this.req.headers['origin'] || '' - , location = ((this.manager.settings['match origin protocol'] ? - origin.match(/^https/) : this.socket.encrypted) ? - 'wss' : 'ws') - + '://' + this.req.headers.host + this.req.url; - - if (!this.verifyOrigin(origin)) { - this.log.warn(this.name + ' connection invalid: origin mismatch'); - this.end(); - return; - } - - if (!this.req.headers['sec-websocket-key']) { - this.log.warn(this.name + ' connection invalid: received no key'); - this.end(); - return; - } - - // calc key - var key = this.req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - try { - this.socket.write(headers.concat('', '').join('\r\n')); - this.socket.setTimeout(0); - this.socket.setNoDelay(true); - } catch (e) { - this.end(); - return; - } - - this.socket.on('data', function (data) { - self.parser.add(data); - }); -}; - -/** - * Verifies the origin of a request. - * - * @api private - */ - -WebSocket.prototype.verifyOrigin = function (origin) { - var origins = this.manager.get('origins'); - - if (origin === 'null') origin = '*'; - - if (origins.indexOf('*:*') !== -1) { - return true; - } - - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~origins.indexOf(parts.hostname + ':' + parts.port) || - ~origins.indexOf(parts.hostname + ':*') || - ~origins.indexOf('*:' + parts.port); - if (!ok) this.log.warn('illegal origin: ' + origin); - return ok; - } catch (ex) { - this.log.warn('error parsing origin'); - } - } - else { - this.log.warn('origin missing from websocket call, yet required by config'); - } - return false; -}; - -/** - * Writes to the socket. - * - * @api private - */ - -WebSocket.prototype.write = function (data) { - if (this.open) { - var buf = this.frame(0x81, data); - try { - this.socket.write(buf, 'binary'); - } - catch (e) { - this.end(); - return; - } - this.log.debug(this.name + ' writing', data); - } -}; - -/** - * Writes a payload. - * - * @api private - */ - -WebSocket.prototype.payload = function (msgs) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.write(msgs[i]); - } - - return this; -}; - -/** - * Frame server-to-client output as a text packet. - * - * @api private - */ - -WebSocket.prototype.frame = function (opcode, str) { - var dataBuffer = new Buffer(str) - , dataLength = dataBuffer.length - , startOffset = 2 - , secondByte = dataLength; - if (dataLength > 65536) { - startOffset = 10; - secondByte = 127; - } - else if (dataLength > 125) { - startOffset = 4; - secondByte = 126; - } - var outputBuffer = new Buffer(dataLength + startOffset); - outputBuffer[0] = opcode; - outputBuffer[1] = secondByte; - dataBuffer.copy(outputBuffer, startOffset); - switch (secondByte) { - case 126: - outputBuffer[2] = dataLength >>> 8; - outputBuffer[3] = dataLength % 256; - break; - case 127: - var l = dataLength; - for (var i = 1; i <= 8; ++i) { - outputBuffer[startOffset - i] = l & 0xff; - l >>>= 8; - } - } - return outputBuffer; -}; - -/** - * Closes the connection. - * - * @api private - */ - -WebSocket.prototype.doClose = function () { - this.socket.end(); -}; - -/** - * WebSocket parser - * - * @api public - */ - -function Parser () { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.overflow = null; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = ''; - - var self = this; - this.opcodeHandlers = { - // text - '1': function(data) { - var finish = function(mask, data) { - self.currentMessage += self.unmask(mask, data); - if (self.state.lastFragment) { - self.emit('data', self.currentMessage); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // binary - '2': function(data) { - var finish = function(mask, data) { - if (typeof self.currentMessage == 'string') self.currentMessage = []; // build a buffer list - self.currentMessage.push(self.unmask(mask, data, true)); - if (self.state.lastFragment) { - self.emit('binary', self.concatBuffers(self.currentMessage)); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // close - '8': function(data) { - self.emit('close'); - self.reset(); - }, - // ping - '9': function(data) { - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported'); - return; - } - - var finish = function(mask, data) { - self.emit('ping', self.unmask(mask, data)); - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength == 0) { - finish(null, null); - } - else if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - expectData(util.unpack(data)); - }); - } - } - } - - this.expect('Opcode', 2, this.processPacket); -}; - -/** - * Inherits from EventEmitter. - */ - -Parser.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add new data to the parser. - * - * @api public - */ - -Parser.prototype.add = function(data) { - if (this.expectBuffer == null) { - this.addToOverflow(data); - return; - } - var toRead = Math.min(data.length, this.expectBuffer.length - this.expectOffset); - data.copy(this.expectBuffer, this.expectOffset, 0, toRead); - this.expectOffset += toRead; - if (toRead < data.length) { - // at this point the overflow buffer shouldn't at all exist - this.overflow = new Buffer(data.length - toRead); - data.copy(this.overflow, 0, toRead, toRead + this.overflow.length); - } - if (this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } -} - -/** - * Adds a piece of data to the overflow. - * - * @api private - */ - -Parser.prototype.addToOverflow = function(data) { - if (this.overflow == null) this.overflow = data; - else { - var prevOverflow = this.overflow; - this.overflow = new Buffer(this.overflow.length + data.length); - prevOverflow.copy(this.overflow, 0); - data.copy(this.overflow, prevOverflow.length); - } -} - -/** - * Waits for a certain amount of bytes to be available, then fires a callback. - * - * @api private - */ - -Parser.prototype.expect = function(what, length, handler) { - this.expectBuffer = new Buffer(length); - this.expectOffset = 0; - this.expectHandler = handler; - if (this.overflow != null) { - var toOverflow = this.overflow; - this.overflow = null; - this.add(toOverflow); - } -} - -/** - * Start processing a new packet. - * - * @api private - */ - -Parser.prototype.processPacket = function (data) { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty'); - return; - } - this.state.lastFragment = (data[0] & 0x80) == 0x80; - this.state.masked = (data[1] & 0x80) == 0x80; - var opcode = data[0] & 0xf; - if (opcode == 0) { - // continuation frame - this.state.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode') - return; - } - } - else { - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.activeFragmentedOperation = opcode; - } - } - var handler = this.opcodeHandlers[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode); - else handler(data); -} - -/** - * Endprocessing a packet. - * - * @api private - */ - -Parser.prototype.endPacket = function() { - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - if (this.state.lastFragment && this.state.opcode == this.state.activeFragmentedOperation) { - // end current fragmented operation - this.state.activeFragmentedOperation = null; - } - this.state.lastFragment = false; - this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; - this.state.masked = false; - this.expect('Opcode', 2, this.processPacket); -} - -/** - * Reset the parser state. - * - * @api private - */ - -Parser.prototype.reset = function() { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = null; - this.currentMessage = ''; -} - -/** - * Unmask received data. - * - * @api private - */ - -Parser.prototype.unmask = function (mask, buf, binary) { - if (mask != null) { - for (var i = 0, ll = buf.length; i < ll; i++) { - buf[i] ^= mask[i % 4]; - } - } - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; -} - -/** - * Concatenates a list of buffers. - * - * @api private - */ - -Parser.prototype.concatBuffers = function(buffers) { - var length = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - length += buffers[i].length; - } - var mergedBuffer = new Buffer(length); - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - buffers[i].copy(mergedBuffer, offset); - offset += buffers[i].length; - } - return mergedBuffer; -} - -/** - * Handles an error - * - * @api private - */ - -Parser.prototype.error = function (reason) { - this.reset(); - this.emit('error', reason); - return this; -}; diff --git a/realtime/node_modules/socket.io/lib/transports/websocket/index.js b/realtime/node_modules/socket.io/lib/transports/websocket/index.js deleted file mode 100644 index 3a952b75..00000000 --- a/realtime/node_modules/socket.io/lib/transports/websocket/index.js +++ /dev/null @@ -1,11 +0,0 @@ - -/** - * Export websocket versions. - */ - -module.exports = { - 7: require('./hybi-07-12'), - 8: require('./hybi-07-12'), - 13: require('./hybi-16'), - default: require('./default') -}; diff --git a/realtime/node_modules/socket.io/lib/transports/xhr-polling.js b/realtime/node_modules/socket.io/lib/transports/xhr-polling.js deleted file mode 100644 index 1db5aeee..00000000 --- a/realtime/node_modules/socket.io/lib/transports/xhr-polling.js +++ /dev/null @@ -1,69 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPPolling = require('./http-polling'); - -/** - * Export the constructor. - */ - -exports = module.exports = XHRPolling; - -/** - * Ajax polling transport. - * - * @api public - */ - -function XHRPolling (mng, data, req) { - HTTPPolling.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -XHRPolling.prototype.__proto__ = HTTPPolling.prototype; - -/** - * Transport name - * - * @api public - */ - -XHRPolling.prototype.name = 'xhr-polling'; - -/** - * Frames data prior to write. - * - * @api private - */ - -XHRPolling.prototype.doWrite = function (data) { - HTTPPolling.prototype.doWrite.call(this); - - var origin = this.req.headers.origin - , headers = { - 'Content-Type': 'text/plain; charset=UTF-8' - , 'Content-Length': data === undefined ? 0 : Buffer.byteLength(data) - , 'Connection': 'Keep-Alive' - }; - - if (origin) { - // https://developer.mozilla.org/En/HTTP_Access_Control - headers['Access-Control-Allow-Origin'] = origin; - headers['Access-Control-Allow-Credentials'] = 'true'; - } - - this.response.writeHead(200, headers); - this.response.write(data); - this.log.debug(this.name + ' writing', data); -}; diff --git a/realtime/node_modules/socket.io/lib/util.js b/realtime/node_modules/socket.io/lib/util.js deleted file mode 100644 index f7d9f2b4..00000000 --- a/realtime/node_modules/socket.io/lib/util.js +++ /dev/null @@ -1,50 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -/** - * Converts an enumerable to an array. - * - * @api public - */ - -exports.toArray = function (enu) { - var arr = []; - - for (var i = 0, l = enu.length; i < l; i++) - arr.push(enu[i]); - - return arr; -}; - -/** - * Unpacks a buffer to a number. - * - * @api public - */ - -exports.unpack = function (buffer) { - var n = 0; - for (var i = 0; i < buffer.length; ++i) { - n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; - } - return n; -} - -/** - * Left pads a string. - * - * @api public - */ - -exports.padl = function (s,n,c) { - return new Array(1 + n - s.length).join(c) + s; -} - diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/.npmignore b/realtime/node_modules/socket.io/node_modules/policyfile/.npmignore deleted file mode 100644 index b512c09d..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/LICENSE b/realtime/node_modules/socket.io/node_modules/policyfile/LICENSE deleted file mode 100644 index bdb8f617..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Arnout Kazemier,3rd-Eden - -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/realtime/node_modules/socket.io/node_modules/policyfile/Makefile b/realtime/node_modules/socket.io/node_modules/policyfile/Makefile deleted file mode 100644 index 1362d66a..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -doc: - dox --title "FlashPolicyFileServer" lib/* > doc/index.html - -test: - expresso -I lib $(TESTFLAGS) tests/*.test.js - -.PHONY: test doc \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/README.md b/realtime/node_modules/socket.io/node_modules/policyfile/README.md deleted file mode 100644 index 527921ee..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/README.md +++ /dev/null @@ -1,98 +0,0 @@ -## LOL, WUT? -It basically allows you to allow or disallow Flash Player sockets from accessing your site. - -## Installation - -```bash -npm install policyfile -``` -## Usage - -The server is based on the regular and know `net` and `http` server patterns. So it you can just listen -for all the events that a `net` based server emits etc. But there is one extra event, the `connect_failed` -event. This event is triggered when we are unable to listen on the supplied port number. - -### createServer -Creates a new server instance and accepts 2 optional arguments: - -- `options` **Object** Options to configure the server instance - - `log` **Boolean** Enable logging to STDOUT and STDERR (defaults to true) -- `origins` **Array** An Array of origins that are allowed by the server (defaults to *:*) - -```js -var pf = require('policyfile'); -pf.createServer(); -pf.listen(); -``` - -#### server.listen -Start listening on the server and it takes 3 optional arguments - -- `port` **Number** On which port number should we listen? (defaults to 843, which is the first port number the FlashPlayer checks) -- `server` **Server** A http server, if we are unable to accept requests or run the server we can also answer the policy requests inline over the supplied HTTP server. -- `callback` **Function** A callback function that is called when listening to the server was successful. - -```js -var pf = require('policyfile'); -pf.createServer(); -pf.listen(1337, function(){ - console.log(':3 yay') -}); -``` - -Changing port numbers can be handy if you do not want to run your server as root and have port 843 forward to a non root port number (aka a number above 1024). - -```js -var pf = require('policyfile') - , http = require('http'); - -server = http.createServer(function(q,r){r.writeHead(200);r.end('hello world')}); -server.listen(80); - -pf.createServer(); -pf.listen(1337, server, function(){ - console.log(':3 yay') -}); -``` - -Support for serving inline requests over a existing HTTP connection as the FlashPlayer will first check port 843, but if it's unable to get a response there it will send a policy file request over port 80, which is usually your http server. - -#### server.add -Adds more origins to the policy file you can add as many arguments as you like. - -```js -var pf = require('policyfile'); -pf.createServer(['google.com:80']); -pf.listen(); -pf.add('blog.3rd-Eden.com:80', 'blog.3rd-Eden.com:8080'); // now has 3 origins -``` - -#### server.add -Adds more origins to the policy file you can add as many arguments as you like. - -```js -var pf = require('policyfile'); -pf.createServer(['blog.3rd-Eden.com:80', 'blog.3rd-Eden.com:8080']); -pf.listen(); -pf.remove('blog.3rd-Eden.com:8080'); // only contains the :80 version now -``` - -#### server.close -Shuts down the server - -```js -var pf = require('policyfile'); -pf.createServer(); -pf.listen(); -pf.close(); // OH NVM. -``` - -## API -http://3rd-eden.com/FlashPolicyFileServer/ - -## Examples -See https://github.com/3rd-Eden/FlashPolicyFileServer/tree/master/examples for examples - -## Licence - -MIT see LICENSE file in the repository \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/doc/index.html b/realtime/node_modules/socket.io/node_modules/policyfile/doc/index.html deleted file mode 100644 index 743fcdaf..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/doc/index.html +++ /dev/null @@ -1,375 +0,0 @@ - - - FlashPolicyFileServer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

          FlashPolicyFileServer

          server

          lib/server.js
          -

          Module dependencies and cached references. -

          -
          -
          var slice = Array.prototype.slice
          -  , net = require('net');
          -
          -

          The server that does the Policy File severing

          - -

          Options

          - -
          • log false or a function that can output log information, defaults to console.log?
          - -

          - -
          • param: Object options Options to customize the servers functionality.

          • param: Array origins The origins that are allowed on this server, defaults to *:*.

          • api: public

          -
          -
          function Server(options, origins){
          -  var me = this;
          -  
          -  this.origins = origins || ['*:*'];
          -  this.port = 843;
          -  this.log = console.log;
          -  
          -  // merge `this` with the options
          -  Object.keys(options).forEach(function(key){
          -    me[key] &amp;&amp; (me[key] = options[key])
          -  });
          -  
          -  // create the net server
          -  this.socket = net.createServer(function createServer(socket){
          -    socket.on('error', function socketError(){ me.responder.call(me, socket) });
          -    me.responder.call(me, socket);
          -  });
          -  
          -  // Listen for errors as the port might be blocked because we do not have root priv.
          -  this.socket.on('error', function serverError(err){
          -    // Special and common case error handling
          -    if (err.errno == 13){
          -      me.log &amp;&amp; me.log(
          -        'Unable to listen to port `' + me.port + '` as your Node.js instance does not have root privileges. ' +
          -        (
          -          me.server
          -          ? 'The Flash Policy file will now be served inline over the supplied HTTP server, Flash Policy files request will suffer.'
          -          : 'No fallback server supplied.'
          -        )
          -      );
          -      
          -      me.socket.removeAllListeners();
          -      delete me.socket;
          -
          -      me.emit('connect_failed', err);
          -    } else {
          -      me.log &amp;&amp; me.log('FlashPolicyFileServer received a error event:\n' + (err.message ? err.message : err));
          -    }
          -  });
          -  
          -  this.socket.on('timeout', function serverTimeout(){});
          -  this.socket.on('close', function serverClosed(err){
          -    err &amp;&amp; me.log &amp;&amp; me.log('Server closing due to an error: \n' + (err.message ? err.message : err));
          -    
          -    if (me.server){
          -      // not online anymore
          -      delete me.server.online;
          -      
          -      // Remove the inline policy listener if we close down
          -      // but only when the server was `online` (see listen prototype)
          -      if( me.server['@'] &amp;&amp; me.server.online){
          -        me.server.removeListener('connection', me.server['@']);
          -      }
          -    }
          -    me.log &amp;&amp; me.log('Shutting down FlashPolicyFileServer');
          -  });
          -  
          -  // Compile the initial `buffer`
          -  this.compile();
          -}
          -
          -

          Start listening for requests

          - -

          - -
          • param: Number port The port number it should be listening to.

          • param: Server server A HTTP server instance, this will be used to listen for inline requests

          • param: Function cb The callback needs to be called once server is ready

          • api: public

          -
          -
          Server.prototype.listen = function listen(port, server, cb){
          -  var me = this
          -    , args = slice.call(arguments, 0)
          -    , callback;
          -  
          -  // assign the correct vars, for flexible arguments
          -  args.forEach(function args(arg){
          -    var type = typeof arg;
          -    
          -    if (type === 'number') me.port = arg;
          -    if (type === 'function') callback = arg;
          -    if (type === 'object') me.server = arg;
          -  });
          -  
          -  if (this.server){
          -    
          -    // no one in their right mind would ever create a `@` prototype, so Im just gonna store
          -    // my function on the server, so I can remove it later again once the server(s) closes
          -    this.server['@'] = function connection(socket){
          -      socket.once('data', function requestData(data){
          -        // if it's a Flash policy request, and we can write to the 
          -        if (
          -             data
          -          &amp;&amp; data[0] === 60
          -          &amp;&amp; data.toString() === '<policy-file-request/>\0'
          -          &amp;&amp; socket
          -          &amp;&amp; (socket.readyState === 'open' || socket.readyState === 'writeOnly')
          -        ){
          -          // send the buffer
          -          socket.end(me.buffer);
          -        }
          -      });
          -    };
          -    // attach it
          -    this.server.on('connection', this.server['@']);
          -  }
          -  
          -  // We add a callback method, so we can set a flag for when the server is `enabled` or `online`.
          -  // this flag is needed because if a error occurs and the we cannot boot up the server the
          -  // fallback functionality should not be removed during the `close` event
          -  this.socket.listen(this.port, function serverListening(){
          -   me.socket.online = true;
          -   
          -   if (callback) callback(), callback = undefined;
          -   
          -  });
          -  
          -  return this;
          -};
          -
          -

          Adds a new origin to the Flash Policy File.

          - -

          - -
          • param: Arguments The origins that need to be added.

          • api: public

          -
          -
          Server.prototype.add = function add(){
          -  var args = slice.call(arguments, 0)
          -    , i = args.length;
          -  
          -  // flag duplicates
          -  while (i--){
          -    if (this.origins.indexOf(args[i]) &gt;= 0){
          -      args[i] = null;
          -    }
          -  }
          -  
          -  // Add all the arguments to the array
          -  // but first we want to remove all `falsy` values from the args
          -  Array.prototype.push.apply(
          -    this.origins
          -  , args.filter(function(value){ return !!value })
          -  );
          -  
          -  this.compile();
          -  return this;
          -};
          -
          -

          Removes a origin from the Flash Policy File.

          - -

          - -
          • param: String origin The origin that needs to be removed from the server

          • api: public

          -
          -
          Server.prototype.remove = function remove(origin){
          -  var position = this.origins.indexOf(origin);
          -  
          -  // only remove and recompile if we have a match
          -  if (position &gt; 0){
          -    this.origins.splice(position,1);
          -    this.compile();
          -  }
          -  
          -  return this;
          -};
          -
          -

          Closes and cleans up the server

          - -
          • api: public

          -
          -
          Server.prototype.close = function close(){
          -  this.socket.removeAllListeners();
          -  this.socket.close();
          -  
          -  return this;
          -};
          -
          -

          Proxy the event listener requests to the created Net server -

          -
          -
          Object.keys(process.EventEmitter.prototype).forEach(function proxy(key){
          -  Server.prototype[key] = Server.prototype[key] || function (){
          -    if (this.socket) this.socket[key].apply(this.socket, arguments);
          -    return this;
          -  };
          -});
          -
          -

          Creates a new server instance.

          - -

          - -
          • param: Object options A options object to override the default config

          • param: Array origins The origins that should be allowed by the server

          • api: public

          -
          -
          exports.createServer = function createServer(options, origins){
          -  origins = Array.isArray(origins) ? origins : (Array.isArray(options) ? options : false);
          -  options = !Array.isArray(options) &amp;&amp; options ? options : {};
          -  
          -  return new Server(options, origins);
          -};
          -
          -

          Provide a hook to the original server, so it can be extended if needed. -

          -
          -
          exports.Server = Server;
          -
          -

          Module version -

          -
          -
          exports.version = '0.0.2';
          -
          -
          \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/examples/basic.fallback.js b/realtime/node_modules/socket.io/node_modules/policyfile/examples/basic.fallback.js deleted file mode 100644 index b439449a..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/examples/basic.fallback.js +++ /dev/null @@ -1,8 +0,0 @@ -var http = require('http') - , fspfs = require('../'); - -var server = http.createServer(function(q,r){ r.writeHead(200); r.end(':3') }) - , flash = fspfs.createServer(); - -server.listen(8080); -flash.listen(8081,server); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/examples/basic.js b/realtime/node_modules/socket.io/node_modules/policyfile/examples/basic.js deleted file mode 100644 index 5e2290f7..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/examples/basic.js +++ /dev/null @@ -1,5 +0,0 @@ -var http = require('http') - , fspfs = require('../'); - -var flash = fspfs.createServer(); -flash.listen(); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/index.js b/realtime/node_modules/socket.io/node_modules/policyfile/index.js deleted file mode 100644 index 60cf2989..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/server.js'); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/lib/server.js b/realtime/node_modules/socket.io/node_modules/policyfile/lib/server.js deleted file mode 100644 index a525772b..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/lib/server.js +++ /dev/null @@ -1,289 +0,0 @@ -/** - * Module dependencies and cached references. - */ - -var slice = Array.prototype.slice - , net = require('net'); - -/** - * The server that does the Policy File severing - * - * Options: - * - `log` false or a function that can output log information, defaults to console.log? - * - * @param {Object} options Options to customize the servers functionality. - * @param {Array} origins The origins that are allowed on this server, defaults to `*:*`. - * @api public - */ - -function Server (options, origins) { - var me = this; - - this.origins = origins || ['*:*']; - this.port = 843; - this.log = console.log; - - // merge `this` with the options - Object.keys(options).forEach(function (key) { - me[key] && (me[key] = options[key]) - }); - - // create the net server - this.socket = net.createServer(function createServer (socket) { - socket.on('error', function socketError () { - me.responder.call(me, socket); - }); - - me.responder.call(me, socket); - }); - - // Listen for errors as the port might be blocked because we do not have root priv. - this.socket.on('error', function serverError (err) { - // Special and common case error handling - if (err.errno == 13) { - me.log && me.log( - 'Unable to listen to port `' + me.port + '` as your Node.js instance does not have root privileges. ' + - ( - me.server - ? 'The Flash Policy File requests will only be served inline over the supplied HTTP server. Inline serving is slower than a dedicated server instance.' - : 'No fallback server supplied, we will be unable to answer Flash Policy File requests.' - ) - ); - - me.emit('connect_failed', err); - me.socket.removeAllListeners(); - delete me.socket; - } else { - me.log && me.log('FlashPolicyFileServer received an error event:\n' + (err.message ? err.message : err)); - } - }); - - this.socket.on('timeout', function serverTimeout () {}); - this.socket.on('close', function serverClosed (err) { - err && me.log && me.log('Server closing due to an error: \n' + (err.message ? err.message : err)); - - if (me.server) { - // Remove the inline policy listener if we close down - // but only when the server was `online` (see listen prototype) - if (me.server['@'] && me.server.online) { - me.server.removeListener('connection', me.server['@']); - } - - // not online anymore - delete me.server.online; - } - }); - - // Compile the initial `buffer` - this.compile(); -} - -/** - * Start listening for requests - * - * @param {Number} port The port number it should be listening to. - * @param {Server} server A HTTP server instance, this will be used to listen for inline requests - * @param {Function} cb The callback needs to be called once server is ready - * @api public - */ - -Server.prototype.listen = function listen (port, server, cb){ - var me = this - , args = slice.call(arguments, 0) - , callback; - - // assign the correct vars, for flexible arguments - args.forEach(function args (arg){ - var type = typeof arg; - - if (type === 'number') me.port = arg; - if (type === 'function') callback = arg; - if (type === 'object') me.server = arg; - }); - - if (this.server) { - - // no one in their right mind would ever create a `@` prototype, so Im just gonna store - // my function on the server, so I can remove it later again once the server(s) closes - this.server['@'] = function connection (socket) { - socket.once('data', function requestData (data) { - // if it's a Flash policy request, and we can write to the - if ( - data - && data[0] === 60 - && data.toString() === '\0' - && socket - && (socket.readyState === 'open' || socket.readyState === 'writeOnly') - ){ - // send the buffer - try { - socket.end(me.buffer); - } catch (e) {} - } - }); - }; - - // attach it - this.server.on('connection', this.server['@']); - } - - // We add a callback method, so we can set a flag for when the server is `enabled` or `online`. - // this flag is needed because if a error occurs and the we cannot boot up the server the - // fallback functionality should not be removed during the `close` event - this.port >= 0 && this.socket.listen(this.port, function serverListening () { - me.socket.online = true; - if (callback) { - callback.call(me); - callback = undefined; - } - }); - - return this; -}; - -/** - * Responds to socket connects and writes the compile policy file. - * - * @param {net.Socket} socket The socket that needs to receive the message - * @api private - */ - -Server.prototype.responder = function responder (socket){ - if (socket && socket.readyState == 'open' && socket.end) { - try { - socket.end(this.buffer); - } catch (e) {} - } -}; - -/** - * Compiles the supplied origins to a Flash Policy File format and stores it in a Node.js Buffer - * this way it can be send over the wire without any performance loss. - * - * @api private - */ - -Server.prototype.compile = function compile (){ - var xml = [ - '' - , '' - , '' - ]; - - // add the allow access element - this.origins.forEach(function origin (origin){ - var parts = origin.split(':'); - xml.push(''); - }); - - xml.push(''); - - // store the result in a buffer so we don't have to re-generate it all the time - this.buffer = new Buffer(xml.join(''), 'utf8'); - - return this; -}; - -/** - * Adds a new origin to the Flash Policy File. - * - * @param {Arguments} The origins that need to be added. - * @api public - */ - -Server.prototype.add = function add(){ - var args = slice.call(arguments, 0) - , i = args.length; - - // flag duplicates - while (i--) { - if (this.origins.indexOf(args[i]) >= 0){ - args[i] = null; - } - } - - // Add all the arguments to the array - // but first we want to remove all `falsy` values from the args - Array.prototype.push.apply( - this.origins - , args.filter(function filter (value) { - return !!value; - }) - ); - - this.compile(); - return this; -}; - -/** - * Removes a origin from the Flash Policy File. - * - * @param {String} origin The origin that needs to be removed from the server - * @api public - */ - -Server.prototype.remove = function remove (origin){ - var position = this.origins.indexOf(origin); - - // only remove and recompile if we have a match - if (position > 0) { - this.origins.splice(position,1); - this.compile(); - } - - return this; -}; - -/** - * Closes and cleans up the server - * - * @api public - */ - -Server.prototype.close = function close () { - this.socket.removeAllListeners(); - this.socket.close(); - - return this; -}; - -/** - * Proxy the event listener requests to the created Net server - */ - -Object.keys(process.EventEmitter.prototype).forEach(function proxy (key){ - Server.prototype[key] = Server.prototype[key] || function () { - if (this.socket) { - this.socket[key].apply(this.socket, arguments); - } - - return this; - }; -}); - -/** - * Creates a new server instance. - * - * @param {Object} options A options object to override the default config - * @param {Array} origins The origins that should be allowed by the server - * @api public - */ - -exports.createServer = function createServer(options, origins){ - origins = Array.isArray(origins) ? origins : (Array.isArray(options) ? options : false); - options = !Array.isArray(options) && options ? options : {}; - - return new Server(options, origins); -}; - -/** - * Provide a hook to the original server, so it can be extended if needed. - */ - -exports.Server = Server; - -/** - * Module version - */ - -exports.version = '0.0.4'; diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/package.json b/realtime/node_modules/socket.io/node_modules/policyfile/package.json deleted file mode 100644 index 2cc82608..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "policyfile", - "version": "0.0.4", - "author": { - "name": "Arnout Kazemier" - }, - "description": "Flash Socket Policy File Server. A server to respond to Flash Socket Policy requests, both inline and through a dedicated server instance.", - "main": "index", - "keywords": [ - "flash", - "socket", - "policy", - "file", - "server", - "Flash Socket Policy File Server", - "cross domain" - ], - "directories": { - "lib": "./lib" - }, - "maintainers": [ - { - "name": "Arnout Kazemier", - "email": "info@3rd-Eden.com", - "url": "http://blog.3rd-Eden.com" - } - ], - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/3rd-Eden/FlashPolicyFileServer/blob/master/LICENSE" - } - ], - "repositories": [ - { - "type": "git", - "url": "https://github.com/3rd-Eden/FlashPolicyFileServer.git" - } - ], - "_id": "policyfile@0.0.4", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "14c6eb5dd9402b440085aa94a5957e6ff1eb83b4" - }, - "_from": "policyfile@0.0.4" -} diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.crt b/realtime/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.crt deleted file mode 100644 index 5883cd44..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.crt +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDXTCCAkWgAwIBAgIJAMUSOvlaeyQHMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQwHhcNMTAxMTE2MDkzMjQ5WhcNMTMxMTE1MDkzMjQ5WjBF -MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 -ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEVwfPQQp4X -wtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+1FAE0c5o -exPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404WthquTqg -S7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy25IyBK3QJ -c+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWAQsqW+COL -0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABo1AwTjAdBgNVHQ4EFgQUDnV4d6mD -tOnluLoCjkUHTX/n4agwHwYDVR0jBBgwFoAUDnV4d6mDtOnluLoCjkUHTX/n4agw -DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAFwV4MQfTo+qMv9JMiyno -IEiqfOz4RgtmBqRnXUffcjS2dhc7/z+FPZnM79Kej8eLHoVfxCyWRHFlzm93vEdv -wxOCrD13EDOi08OOZfxWyIlCa6Bg8cMAKqQzd2OvQOWqlRWBTThBJIhWflU33izX -Qn5GdmYqhfpc+9ZHHGhvXNydtRQkdxVK2dZNzLBvBlLlRmtoClU7xm3A+/5dddeP -AQHEPtyFlUw49VYtZ3ru6KqPms7MKvcRhYLsy9rwSfuuniMlx4d0bDR7TOkw0QQS -A0N8MGQRQpzl4mw4jLzyM5d5QtuGBh2P6hPGa0YQxtI3RPT/p6ENzzBiAKXiSfzo -xw== ------END CERTIFICATE----- diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.private.key b/realtime/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.private.key deleted file mode 100644 index f31ff3d9..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.private.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEV -wfPQQp4XwtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+ -1FAE0c5oexPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404 -WthquTqgS7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy2 -5IyBK3QJc+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWA -QsqW+COL0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABAoIBAGe4+9VqZfJN+dsq -8Osyuz01uQ8OmC0sAWTIqUlQgENIyf9rCJsUBlYmwR5BT6Z69XP6QhHdpSK+TiAR -XUz0EqG9HYzcxHIBaACP7j6iRoQ8R4kbbiWKo0z3WqQGIOqFjvD/mKEuQdE5mEYw -eOUCG6BnX1WY2Yr8WKd2AA/tp0/Y4d8z04u9eodMpSTbHTzYMJb5SbBN1vo6FY7q -8zSuO0BMzXlAxUsCwHsk1GQHFr8Oh3zIR7bQGtMBouI+6Lhh7sjFYsfxJboqMTBV -IKaA216M6ggHG7MU1/jeKcMGDmEfqQLQoyWp29rMK6TklUgipME2L3UD7vTyAVzz -xbVOpZkCgYEA8CXW4sZBBrSSrLR5SB+Ubu9qNTggLowOsC/kVKB2WJ4+xooc5HQo -mFhq1v/WxPQoWIxdYsfg2odlL+JclK5Qcy6vXmRSdAQ5lK9gBDKxZSYc3NwAw2HA -zyHCTK+I0n8PBYQ+yGcrxu0WqTGnlLW+Otk4CejO34WlgHwbH9bbY5UCgYEA3ZvT -C4+OoMHXlmICSt29zUrYiL33IWsR3/MaONxTEDuvgkOSXXQOl/8Ebd6Nu+3WbsSN -bjiPC/JyL1YCVmijdvFpl4gjtgvfJifs4G+QHvO6YfsYoVANk4u6g6rUuBIOwNK4 -RwYxwDc0oysp+g7tPxoSgDHReEVKJNzGBe9NGGsCgYEA4O4QP4gCEA3B9BF2J5+s -n9uPVxmiyvZUK6Iv8zP4pThTBBMIzNIf09G9AHPQ7djikU2nioY8jXKTzC3xGTHM -GJZ5m6fLsu7iH+nDvSreDSeNkTBfZqGAvoGYQ8uGE+L+ZuRfCcXYsxIOT5s6o4c3 -Dle2rVFpsuKzCY00urW796ECgYBn3go75+xEwrYGQSer6WR1nTgCV29GVYXKPooy -zmmMOT1Yw80NSkEw0pFD4cTyqVYREsTrPU0mn1sPfrOXxnGfZSVFpcR/Je9QVfQ7 -eW7GYxwfom335aqHVj10SxRqteP+UoWWnHujCPz94VRKZMakBddYCIGSan+G6YdS -7sdmwwKBgBc2qj0wvGXDF2kCLwSGfWoMf8CS1+5fIiUIdT1e/+7MfDdbmLMIFVjF -QKS3zVViXCbrG5SY6wS9hxoc57f6E2A8vcaX6zy2xkZlGHQCpWRtEM5R01OWJQaH -HsHMmQZGUQVoDm1oRkDhrTFK4K3ukc3rAxzeTZ96utOQN8/KJsTv ------END RSA PRIVATE KEY----- diff --git a/realtime/node_modules/socket.io/node_modules/policyfile/tests/unit.test.js b/realtime/node_modules/socket.io/node_modules/policyfile/tests/unit.test.js deleted file mode 100644 index 932b3c14..00000000 --- a/realtime/node_modules/socket.io/node_modules/policyfile/tests/unit.test.js +++ /dev/null @@ -1,231 +0,0 @@ -var fspfs = require('../') - , fs = require('fs') - , http = require('http') - , https = require('https') - , net = require('net') - , should = require('should') - , assert = require('assert'); - -module.exports = { - // Library version should be Semver compatible - 'Library version': function(){ - fspfs.version.should.match(/^\d+\.\d+\.\d+$/); - } - - // Creating a server instace should not cause any problems - // either using the new Server or createServer method. -, 'Create Server instance': function(){ - var server = fspfs.createServer() - , server2 = new fspfs.Server({log:false}, ['blog.3rd-Eden.com:1337']); - - // server 2 options test - server2.log.should.be.false; - server2.origins.length.should.equal(1); - server2.origins[0].should.equal('blog.3rd-Eden.com:1337'); - - // server defaults - (typeof server.log).should.be.equal('function'); - server.origins.length.should.equal(1); - server.origins[0].should.equal('*:*'); - - // instance checking, sanity check - assert.ok(server instanceof fspfs.Server); - assert.ok(!!server.buffer); - - // more options testing - server = fspfs.createServer(['blog.3rd-Eden.com:80']); - server.origins.length.should.equal(1); - server.origins[0].should.equal('blog.3rd-Eden.com:80'); - - server = fspfs.createServer({log:false},['blog.3rd-Eden.com:80']); - server.log.should.be.false; - server.origins.length.should.equal(1); - server.origins[0].should.equal('blog.3rd-Eden.com:80'); - - } - -, 'Add origin': function(){ - var server = fspfs.createServer(); - server.add('google.com:80', 'blog.3rd-Eden.com:1337'); - - server.origins.length.should.equal(3); - server.origins.indexOf('google.com:80').should.be.above(0); - - // don't allow duplicates - server.add('google.com:80', 'google.com:80'); - - var i = server.origins.length - , count = 0; - - while(i--){ - if (server.origins[i] === 'google.com:80'){ - count++; - } - } - - count.should.equal(1); - } - -, 'Remove origin': function(){ - var server = fspfs.createServer(); - server.add('google.com:80', 'blog.3rd-Eden.com:1337'); - server.origins.length.should.equal(3); - - server.remove('google.com:80'); - server.origins.length.should.equal(2); - server.origins.indexOf('google.com:80').should.equal(-1); - } - -, 'Buffer': function(){ - var server = fspfs.createServer(); - - Buffer.isBuffer(server.buffer).should.be.true; - server.buffer.toString().indexOf('to-ports="*"').should.be.above(0); - server.buffer.toString().indexOf('domain="*"').should.be.above(0); - server.buffer.toString().indexOf('domain="google.com"').should.equal(-1); - - // The buffers should be rebuild when new origins are added - server.add('google.com:80'); - server.buffer.toString().indexOf('to-ports="80"').should.be.above(0); - server.buffer.toString().indexOf('domain="google.com"').should.be.above(0); - - server.remove('google.com:80'); - server.buffer.toString().indexOf('to-ports="80"').should.equal(-1); - server.buffer.toString().indexOf('domain="google.com"').should.equal(-1); - } - -, 'Responder': function(){ - var server = fspfs.createServer() - , calls = 0 - // dummy socket to emulate a `real` socket - , dummySocket = { - readyState: 'open' - , end: function(buffer){ - calls++; - Buffer.isBuffer(buffer).should.be.true; - buffer.toString().should.equal(server.buffer.toString()); - } - }; - - server.responder(dummySocket); - calls.should.equal(1); - } - -, 'Event proxy': function(){ - var server = fspfs.createServer() - , calls = 0; - - Object.keys(process.EventEmitter.prototype).forEach(function proxy(key){ - assert.ok(!!server[key] && typeof server[key] === 'function'); - }); - - // test if it works by calling a none default event - server.on('pew', function(){ - calls++; - }); - - server.emit('pew'); - calls.should.equal(1); - } - -, 'inline response http': function(){ - var port = 1335 - , httpserver = http.createServer(function(q,r){r.writeHead(200);r.end(':3')}) - , server = fspfs.createServer(); - - httpserver.listen(port, function(){ - server.listen(port + 1, httpserver, function(){ - var client = net.createConnection(port); - client.write('\0'); - client.on('error', function(err){ - assert.ok(!err, err) - }); - client.on('data', function(data){ - - var response = data.toString(); - console.log(response); - - response.indexOf('to-ports="*"').should.be.above(0); - response.indexOf('domain="*"').should.be.above(0); - response.indexOf('domain="google.com"').should.equal(-1); - - // clean up - client.destroy(); - server.close(); - httpserver.close(); - }); - }); - }); - } - -, 'server response': function(){ - var port = 1340 - , server = fspfs.createServer(); - - server.listen(port, function(){ - var client = net.createConnection(port); - client.write('\0'); - client.on('error', function(err){ - assert.ok(!err, err) - }); - client.on('data', function(data){ - - var response = data.toString(); - - response.indexOf('to-ports="*"').should.be.above(0); - response.indexOf('domain="*"').should.be.above(0); - response.indexOf('domain="google.com"').should.equal(-1); - - // clean up - client.destroy(); - server.close(); - }); - }); - } - -, 'inline response https': function(){ - var port = 1345 - , ssl = { - key: fs.readFileSync(__dirname + '/ssl/ssl.private.key').toString() - , cert: fs.readFileSync(__dirname + '/ssl/ssl.crt').toString() - } - , httpserver = https.createServer(ssl, function(q,r){r.writeHead(200);r.end(':3')}) - , server = fspfs.createServer(); - - httpserver.listen(port, function(){ - server.listen(port + 1, httpserver, function(){ - var client = net.createConnection(port); - client.write('\0'); - client.on('error', function(err){ - assert.ok(!err, err) - }); - client.on('data', function(data){ - - var response = data.toString(); - - response.indexOf('to-ports="*"').should.be.above(0); - response.indexOf('domain="*"').should.be.above(0); - response.indexOf('domain="google.com"').should.equal(-1); - - // clean up - client.destroy(); - server.close(); - httpserver.close(); - }); - }); - }); - } - -, 'connect_failed': function(){ - var server = fspfs.createServer(); - - server.on('connect_failed', function(){ - assert.ok(true); - }); - - server.listen(function(){ - assert.ok(false, 'Run this test without root access'); - server.close(); - }); - } -}; \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/.npmignore b/realtime/node_modules/socket.io/node_modules/socket.io-client/.npmignore deleted file mode 100644 index c27cb503..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -test/node_modules -support diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/History.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/History.md deleted file mode 100644 index 8ee017dd..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/History.md +++ /dev/null @@ -1,226 +0,0 @@ - -0.9.11 / 2012-11-02 -=================== - - * Enable use of 'xhr' transport in Node.js - * Fix the problem with disconnecting xhr-polling users - * Add should to devDependencies - * Prefer XmlHttpRequest if CORS is available - * Make client compatible with AMD loaders. - -0.9.10 / 2012-08-10 -=================== - - * fix removeAllListeners to behave as expected. - * set withCredentials to true only if xdomain. - * socket: disable disconnect on unload by default. - -0.9.9 / 2012-08-01 -================== - - * socket: fixed disconnect xhr url and made it actually sync - * *: bump xmlhttprequest dep - -0.9.8 / 2012-07-24 -================== - - * Fixed build. - -0.9.7 / 2012-07-24 -================== - - * iOS websocket crash fix. - * Fixed potential `open` collision. - * Fixed disconnectSync. - -0.9.6 / 2012-04-17 -================== - - * Don't position the jsonp form off the screen (android fix). - -0.9.5 / 2012-04-05 -================== - - * Bumped version. - -0.9.4 / 2012-04-01 -================== - - * Fixes polling loop upon reconnect advice (fixes #438). - -0.9.3 / 2012-03-28 -================== - - * Fix XHR.check, which was throwing an error transparently and causing non-IE browsers to fall back to JSONP [mikito] - * Fixed forced disconnect on window close [zzzaaa] - -0.9.2 / 2012-03-13 -================== - - * Transport order set by "options" [zzzaaa] - -0.9.1-1 / 2012-03-02 -==================== - - * Fixed active-x-obfuscator NPM dependency. - -0.9.1 / 2012-03-02 -================== - - * Misc corrections. - * Added warning within Firefox about webworker test in test runner. - * Update ws dependency [einaros] - * Implemented client side heartbeat checks. [felixge] - * Improved Firewall support with ActiveX obfuscation. [felixge] - * Fixed error handling during connection process. [Outsideris] - -0.9.0 / 2012-02-26 -================== - - * Added DS_Store to gitignore. - * Updated depedencies. - * Bumped uglify - * Tweaking code so it doesn't throw an exception when used inside a WebWorker in Firefox - * Do not rely on Array.prototype.indexOf as it breaks with pages that use the Prototype.js library. - * Windows support landed - * Use @einaros ws module instead of the old crap one - * Fix for broken closeTimeout and 'IE + xhr' goes into infinite loop on disconnection - * Disabled reconnection on error if reconnect option is set to false - * Set withCredentials to true before xhr to fix authentication - * Clears the timeout from reconnection attempt when there is a successful or failed reconnection. - This fixes the issue of setTimeout's carrying over from previous reconnection - and changing (skipping) values of self.reconnectionDelay in the newer reconnection. - * Removed decoding of parameters when chunking the query string. - This was used later on to construct the url to post to the socket.io server - for connection and if we're adding custom parameters of our own to this url - (for example for OAuth authentication) they were being sent decoded, which is wrong. - -0.8.7 / 2011-11-05 -================== - - * Bumped client - -0.8.6 / 2011-10-27 -================== - - * Added WebWorker support. - * Fixed swfobject and web_socket.js to not assume window. - * Fixed CORS detection for webworker. - * Fix `defer` for webkit in a webworker. - * Fixed io.util.request to not rely on window. - * FIxed; use global instead of window and dont rely on document. - * Fixed; JSON-P handshake if CORS is not available. - * Made underlying Transport disconnection trigger immediate socket.io disconnect. - * Fixed warning when compressing with Google Closure Compiler. - * Fixed builder's uglify utf-8 support. - * Added workaround for loading indicator in FF jsonp-polling. [3rd-Eden] - * Fixed host discovery lookup. [holic] - * Fixed close timeout when disconnected/reconnecting. [jscharlach] - * Fixed jsonp-polling feature detection. - * Fixed jsonp-polling client POSTing of \n. - * Fixed test runner on IE6/7 - -0.8.5 / 2011-10-07 -================== - - * Bumped client - -0.8.4 / 2011-09-06 -================== - - * Corrected build - -0.8.3 / 2011-09-03 -================== - - * Fixed `\n` parsing for non-JSON packets. - * Fixed; make Socket.IO XHTML doctype compatible (fixes #460 from server) - * Fixed support for Node.JS running `socket.io-client`. - * Updated repository name in `package.json`. - * Added support for different policy file ports without having to port - forward 843 on the server side [3rd-Eden] - -0.8.2 / 2011-08-29 -================== - - * Fixed flashsocket detection. - -0.8.1 / 2011-08-29 -================== - - * Bump version. - -0.8.0 / 2011-08-28 -================== - - * Added MozWebSocket support (hybi-10 doesn't require API changes) [einaros]. - -0.7.11 / 2011-08-27 -=================== - - * Corrected previous release (missing build). - -0.7.10 / 2011-08-27 -=================== - - * Fix for failing fallback in websockets - -0.7.9 / 2011-08-12 -================== - - * Added check on `Socket#onConnect` to prevent double `connect` events on the main manager. - * Fixed socket namespace connect test. Remove broken alternative namespace connect test. - * Removed test handler for removed test. - * Bumped version to match `socket.io` server. - -0.7.5 / 2011-08-08 -================== - - * Added querystring support for `connect` [3rd-Eden] - * Added partial Node.JS transports support [3rd-Eden, josephg] - * Fixed builder test. - * Changed `util.inherit` to replicate Object.create / __proto__. - * Changed and cleaned up some acceptance tests. - * Fixed race condition with a test that could not be run multiple times. - * Added test for encoding a payload. - * Added the ability to override the transport to use in acceptance test [3rd-Eden] - * Fixed multiple connect packets [DanielBaulig] - * Fixed jsonp-polling over-buffering [3rd-Eden] - * Fixed ascii preservation in minified socket.io client [3rd-Eden] - * Fixed socket.io in situations where the page is not served through utf8. - * Fixed namespaces not reconnecting after disconnect [3rd-Eden] - * Fixed default port for secure connections. - -0.7.4 / 2011-07-12 -================== - - * Added `SocketNamespace#of` shortcut. [3rd-Eden] - * Fixed a IE payload decoding bug. [3rd-Eden] - * Honor document protocol, unless overriden. [dvv] - * Fixed new builder dependencies. [3rd-Eden] - -0.7.3 / 2011-06-30 -================== - - * Fixed; acks don't depend on arity. They're automatic for `.send` and - callback based for `.emit`. [dvv] - * Added support for sub-sockets authorization. [3rd-Eden] - * Added BC support for `new io.connect`. [fat] - * Fixed double `connect` events. [3rd-Eden] - * Fixed reconnection with jsonp-polling maintaining old sessionid. [franck34] - -0.7.2 / 2011-06-22 -================== - - * Added `noop` message type. - -0.7.1 / 2011-06-21 -================== - - * Bumped socket.io dependency version for acceptance tests. - -0.7.0 / 2011-06-21 -================== - - * http://socket.io/announcement.html - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/Makefile b/realtime/node_modules/socket.io/node_modules/socket.io-client/Makefile deleted file mode 100644 index f2d2f41a..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/Makefile +++ /dev/null @@ -1,20 +0,0 @@ - -ALL_TESTS = $(shell find test/ -name '*.test.js') - -run-tests: - @./node_modules/.bin/expresso \ - -I lib \ - -I support \ - --serial \ - $(TESTS) - -test: - @$(MAKE) TESTS="$(ALL_TESTS)" run-tests - -test-acceptance: - @node support/test-runner/app $(TRANSPORT) - -build: - @node ./bin/builder.js - -.PHONY: test diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/README.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/README.md deleted file mode 100644 index cdb7715a..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/README.md +++ /dev/null @@ -1,246 +0,0 @@ -socket.io -========= - -#### Sockets for the rest of us - -The `socket.io` client is basically a simple HTTP Socket interface implementation. -It looks similar to WebSocket while providing additional features and -leveraging other transports when WebSocket is not supported by the user's -browser. - -```js -var socket = io.connect('http://domain.com'); -socket.on('connect', function () { - // socket connected -}); -socket.on('custom event', function () { - // server emitted a custom event -}); -socket.on('disconnect', function () { - // socket disconnected -}); -socket.send('hi there'); -``` - -### Recipes - -#### Utilizing namespaces (ie: multiple sockets) - -If you want to namespace all the messages and events emitted to a particular -endpoint, simply specify it as part of the `connect` uri: - -```js -var chat = io.connect('http://localhost/chat'); -chat.on('connect', function () { - // chat socket connected -}); - -var news = io.connect('/news'); // io.connect auto-detects host -news.on('connect', function () { - // news socket connected -}); -``` - -#### Emitting custom events - -To ease with the creation of applications, you can emit custom events outside -of the global `message` event. - -```js -var socket = io.connect(); -socket.emit('server custom event', { my: 'data' }); -``` - -#### Forcing disconnection - -```js -var socket = io.connect(); -socket.on('connect', function () { - socket.disconnect(); -}); -``` - -### Documentation - -#### io#connect - -```js -io.connect(uri, [options]); -``` - -##### Options: - -- *resource* - - socket.io - - The resource is what allows the `socket.io` server to identify incoming connections by `socket.io` clients. In other words, any HTTP server can implement socket.io and still serve other normal, non-realtime HTTP requests. - -- *transports* - -```js -['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling'] -``` - - A list of the transports to attempt to utilize (in order of preference). - -- *'connect timeout'* - -```js -5000 -``` - - The amount of milliseconds a transport has to create a connection before we consider it timed out. - -- *'try multiple transports'* - -```js -true -``` - - A boolean indicating if we should try other transports when the connectTimeout occurs. - -- *reconnect* - -```js -true -``` - - A boolean indicating if we should automatically reconnect if a connection is disconnected. - -- *'reconnection delay'* - -```js -500 -``` - - The amount of milliseconds before we try to connect to the server again. We are using a exponential back off algorithm for the following reconnections, on each reconnect attempt this value will get multiplied (500 > 1000 > 2000 > 4000 > 8000). - - -- *'max reconnection attempts'* - -```js -10 -``` - - The amount of attempts should we make using the current transport to connect to the server? After this we will do one final attempt, and re-try with all enabled transport methods before we give up. - -##### Properties: - -- *options* - - The passed in options combined with the defaults. - -- *connected* - - Whether the socket is connected or not. - -- *connecting* - - Whether the socket is connecting or not. - -- *reconnecting* - - Whether we are reconnecting or not. - -- *transport* - - The transport instance. - -##### Methods: - -- *connect(λ)* - - Establishes a connection. If λ is supplied as argument, it will be called once the connection is established. - -- *send(message)* - - A string of data to send. - -- *disconnect* - - Closes the connection. - -- *on(event, λ)* - - Adds a listener for the event *event*. - -- *once(event, λ)* - - Adds a one time listener for the event *event*. The listener is removed after the first time the event is fired. - -- *removeListener(event, λ)* - - Removes the listener λ for the event *event*. - -##### Events: - -- *connect* - - Fired when the connection is established and the handshake successful. - -- *connecting(transport_type)* - - Fired when a connection is attempted, passing the transport name. - -- *connect_failed* - - Fired when the connection timeout occurs after the last connection attempt. - This only fires if the `connectTimeout` option is set. - If the `tryTransportsOnConnectTimeout` option is set, this only fires once all - possible transports have been tried. - -- *message(message)* - - Fired when a message arrives from the server - -- *close* - - Fired when the connection is closed. Be careful with using this event, as some transports will fire it even under temporary, expected disconnections (such as XHR-Polling). - -- *disconnect* - - Fired when the connection is considered disconnected. - -- *reconnect(transport_type,reconnectionAttempts)* - - Fired when the connection has been re-established. This only fires if the `reconnect` option is set. - -- *reconnecting(reconnectionDelay,reconnectionAttempts)* - - Fired when a reconnection is attempted, passing the next delay for the next reconnection. - -- *reconnect_failed* - - Fired when all reconnection attempts have failed and we where unsuccessful in reconnecting to the server. - -### Contributors - -Guillermo Rauch <guillermo@learnboost.com> - -Arnout Kazemier <info@3rd-eden.com> - -### License - -(The MIT License) - -Copyright (c) 2010 LearnBoost <dev@learnboost.com> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/bin/builder.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/bin/builder.js deleted file mode 100644 index 7383c75a..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/bin/builder.js +++ /dev/null @@ -1,303 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , socket = require('../lib/io') - , uglify = require('uglify-js') - , activeXObfuscator = require('active-x-obfuscator'); - -/** - * License headers. - * - * @api private - */ - -var template = '/*! Socket.IO.%ext% build:' + socket.version + ', %type%. Copyright(c) 2011 LearnBoost MIT Licensed */\n' - , development = template.replace('%type%', 'development').replace('%ext%', 'js') - , production = template.replace('%type%', 'production').replace('%ext%', 'min.js'); - -/** - * If statements, these allows you to create serveride & client side compatible - * code using specially designed `if` statements that remove serverside - * designed code from the source files - * - * @api private - */ - -var starttagIF = '// if node' - , endtagIF = '// end node'; - -/** - * The modules that are required to create a base build of Socket.IO. - * - * @const - * @type {Array} - * @api private - */ - -var base = [ - 'io.js' - , 'util.js' - , 'events.js' - , 'json.js' - , 'parser.js' - , 'transport.js' - , 'socket.js' - , 'namespace.js' - ]; - -/** - * The available transports for Socket.IO. These are mapped as: - * - * - `key` the name of the transport - * - `value` the dependencies for the transport - * - * @const - * @type {Object} - * @api public - */ - -var baseTransports = { - 'websocket': ['transports/websocket.js'] - , 'flashsocket': [ - 'transports/websocket.js' - , 'transports/flashsocket.js' - , 'vendor/web-socket-js/swfobject.js' - , 'vendor/web-socket-js/web_socket.js' - ] - , 'htmlfile': ['transports/xhr.js', 'transports/htmlfile.js'] - /* FIXME: re-enable me once we have multi-part support - , 'xhr-multipart': ['transports/xhr.js', 'transports/xhr-multipart.js'] */ - , 'xhr-polling': ['transports/xhr.js', 'transports/xhr-polling.js'] - , 'jsonp-polling': [ - 'transports/xhr.js' - , 'transports/xhr-polling.js' - , 'transports/jsonp-polling.js' - ] -}; - -/** - * Wrappers for client-side usage. - * This enables usage in top-level browser window, client-side CommonJS systems and AMD loaders. - * If doing a node build for server-side client, this wrapper is NOT included. - * @api private - */ -var wrapperPre = "\nvar io = ('undefined' === typeof module ? {} : module.exports);\n(function() {\n"; - -var wrapperPost = "\nif (typeof define === \"function\" && define.amd) {" + - "\n define([], function () { return io; });" + - "\n}\n})();"; - - -/** - * Builds a custom Socket.IO distribution based on the transports that you - * need. You can configure the build to create development build or production - * build (minified). - * - * @param {Array} transports The transports that needs to be bundled. - * @param {Object} [options] Options to configure the building process. - * @param {Function} callback Last argument should always be the callback - * @callback {String|Boolean} err An optional argument, if it exists than an error - * occurred during the build process. - * @callback {String} result The result of the build process. - * @api public - */ - -var builder = module.exports = function () { - var transports, options, callback, error = null - , args = Array.prototype.slice.call(arguments, 0) - , settings = { - minify: true - , node: false - , custom: [] - }; - - // Fancy pancy argument support this makes any pattern possible mainly - // because we require only one of each type - args.forEach(function (arg) { - var type = Object.prototype.toString.call(arg) - .replace(/\[object\s(\w+)\]/gi , '$1' ).toLowerCase(); - - switch (type) { - case 'array': - return transports = arg; - case 'object': - return options = arg; - case 'function': - return callback = arg; - } - }); - - // Add defaults - options = options || {}; - transports = transports || Object.keys(baseTransports); - - // Merge the data - for(var option in options) { - settings[option] = options[option]; - } - - // Start creating a dependencies chain with all the required files for the - // custom Socket.IO bundle. - var files = []; - base.forEach(function (file) { - files.push(__dirname + '/../lib/' + file); - }); - - transports.forEach(function (transport) { - var dependencies = baseTransports[transport]; - if (!dependencies) { - error = 'Unsupported transport `' + transport + '` supplied as argument.'; - return; - } - - // Add the files to the files list, but only if they are not added before - dependencies.forEach(function (file) { - var path = __dirname + '/../lib/' + file; - if (!~files.indexOf(path)) files.push(path); - }) - }); - - // check to see if the files tree compilation generated any errors. - if (error) return callback(error); - - var results = {}; - files.forEach(function (file) { - fs.readFile(file, function (err, content) { - if (err) error = err; - results[file] = content; - - // check if we are done yet, or not.. Just by checking the size of the result - // object. - if (Object.keys(results).length !== files.length) return; - - // we are done, did we error? - if (error) return callback(error); - - // start with the license header - var code = development - , ignore = 0; - - // pre-wrapper for non-server-side builds - if (!settings.node) code += wrapperPre; - - // concatenate the file contents in order - files.forEach(function (file) { - code += results[file]; - }); - - // check if we need to add custom code - if (settings.custom.length) { - settings.custom.forEach(function (content) { - code += content; - }); - } - - // post-wrapper for non-server-side builds - if (!settings.node) { - code += wrapperPost; - } - - code = activeXObfuscator(code); - - // Search for conditional code blocks that need to be removed as they - // where designed for a server side env. but only if we don't want to - // make this build node compatible. - if (!settings.node) { - code = code.split('\n').filter(function (line) { - // check if there are tags in here - var start = line.indexOf(starttagIF) >= 0 - , end = line.indexOf(endtagIF) >= 0 - , ret = ignore; - - // ignore the current line - if (start) { - ignore++; - ret = ignore; - } - - // stop ignoring the next line - if (end) { - ignore--; - } - - return ret == 0; - }).join('\n'); - } - - // check if we need to process it any further - if (settings.minify) { - var ast = uglify.parser.parse(code); - ast = uglify.uglify.ast_mangle(ast); - ast = uglify.uglify.ast_squeeze(ast); - - code = production + uglify.uglify.gen_code(ast, { ascii_only: true }); - } - - callback(error, code); - }) - }) -}; - -/** - * Builder version is also the current client version - * this way we don't have to do another include for the - * clients version number and we can just include the builder. - * - * @type {String} - * @api public - */ - -builder.version = socket.version; - -/** - * A list of all build in transport types. - * - * @type {Object} - * @api public - */ - -builder.transports = baseTransports; - -/** - * Command line support, this allows us to generate builds without having - * to load it as module. - */ - -if (!module.parent){ - // the first 2 are `node` and the path to this file, we don't need them - var args = process.argv.slice(2); - - // build a development build - builder(args.length ? args : false, { minify:false }, function (err, content) { - if (err) return console.error(err); - - fs.write( - fs.openSync(__dirname + '/../dist/socket.io.js', 'w') - , content - , 0 - , 'utf8' - ); - console.log('Successfully generated the development build: socket.io.js'); - }); - - // and build a production build - builder(args.length ? args : false, function (err, content) { - if (err) return console.error(err); - - fs.write( - fs.openSync(__dirname + '/../dist/socket.io.min.js', 'w') - , content - , 0 - , 'utf8' - ); - console.log('Successfully generated the production build: socket.io.min.js'); - }); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/WebSocketMain.swf b/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/WebSocketMain.swf deleted file mode 100644 index 20a451f5..00000000 Binary files a/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/WebSocketMain.swf and /dev/null differ diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/WebSocketMainInsecure.swf b/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/WebSocketMainInsecure.swf deleted file mode 100644 index 5949ff3d..00000000 Binary files a/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/WebSocketMainInsecure.swf and /dev/null differ diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js deleted file mode 100644 index 6ea5dd0a..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js +++ /dev/null @@ -1,3871 +0,0 @@ -/*! Socket.IO.js build:0.9.11, development. Copyright(c) 2011 LearnBoost MIT Licensed */ - -var io = ('undefined' === typeof module ? {} : module.exports); -(function() { - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, global) { - - /** - * IO namespace. - * - * @namespace - */ - - var io = exports; - - /** - * Socket.IO version - * - * @api public - */ - - io.version = '0.9.11'; - - /** - * Protocol implemented. - * - * @api public - */ - - io.protocol = 1; - - /** - * Available transports, these will be populated with the available transports - * - * @api public - */ - - io.transports = []; - - /** - * Keep track of jsonp callbacks. - * - * @api private - */ - - io.j = []; - - /** - * Keep track of our io.Sockets - * - * @api private - */ - io.sockets = {}; - - - /** - * Manages connections to hosts. - * - * @param {String} uri - * @Param {Boolean} force creation of new socket (defaults to false) - * @api public - */ - - io.connect = function (host, details) { - var uri = io.util.parseUri(host) - , uuri - , socket; - - if (global && global.location) { - uri.protocol = uri.protocol || global.location.protocol.slice(0, -1); - uri.host = uri.host || (global.document - ? global.document.domain : global.location.hostname); - uri.port = uri.port || global.location.port; - } - - uuri = io.util.uniqueUri(uri); - - var options = { - host: uri.host - , secure: 'https' == uri.protocol - , port: uri.port || ('https' == uri.protocol ? 443 : 80) - , query: uri.query || '' - }; - - io.util.merge(options, details); - - if (options['force new connection'] || !io.sockets[uuri]) { - socket = new io.Socket(options); - } - - if (!options['force new connection'] && socket) { - io.sockets[uuri] = socket; - } - - socket = socket || io.sockets[uuri]; - - // if path is different from '' or / - return socket.of(uri.path.length > 1 ? uri.path : ''); - }; - -})('object' === typeof module ? module.exports : (this.io = {}), this); -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, global) { - - /** - * Utilities namespace. - * - * @namespace - */ - - var util = exports.util = {}; - - /** - * Parses an URI - * - * @author Steven Levithan (MIT license) - * @api public - */ - - var re = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; - - var parts = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', - 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', - 'anchor']; - - util.parseUri = function (str) { - var m = re.exec(str || '') - , uri = {} - , i = 14; - - while (i--) { - uri[parts[i]] = m[i] || ''; - } - - return uri; - }; - - /** - * Produces a unique url that identifies a Socket.IO connection. - * - * @param {Object} uri - * @api public - */ - - util.uniqueUri = function (uri) { - var protocol = uri.protocol - , host = uri.host - , port = uri.port; - - if ('document' in global) { - host = host || document.domain; - port = port || (protocol == 'https' - && document.location.protocol !== 'https:' ? 443 : document.location.port); - } else { - host = host || 'localhost'; - - if (!port && protocol == 'https') { - port = 443; - } - } - - return (protocol || 'http') + '://' + host + ':' + (port || 80); - }; - - /** - * Mergest 2 query strings in to once unique query string - * - * @param {String} base - * @param {String} addition - * @api public - */ - - util.query = function (base, addition) { - var query = util.chunkQuery(base || '') - , components = []; - - util.merge(query, util.chunkQuery(addition || '')); - for (var part in query) { - if (query.hasOwnProperty(part)) { - components.push(part + '=' + query[part]); - } - } - - return components.length ? '?' + components.join('&') : ''; - }; - - /** - * Transforms a querystring in to an object - * - * @param {String} qs - * @api public - */ - - util.chunkQuery = function (qs) { - var query = {} - , params = qs.split('&') - , i = 0 - , l = params.length - , kv; - - for (; i < l; ++i) { - kv = params[i].split('='); - if (kv[0]) { - query[kv[0]] = kv[1]; - } - } - - return query; - }; - - /** - * Executes the given function when the page is loaded. - * - * io.util.load(function () { console.log('page loaded'); }); - * - * @param {Function} fn - * @api public - */ - - var pageLoaded = false; - - util.load = function (fn) { - if ('document' in global && document.readyState === 'complete' || pageLoaded) { - return fn(); - } - - util.on(global, 'load', fn, false); - }; - - /** - * Adds an event. - * - * @api private - */ - - util.on = function (element, event, fn, capture) { - if (element.attachEvent) { - element.attachEvent('on' + event, fn); - } else if (element.addEventListener) { - element.addEventListener(event, fn, capture); - } - }; - - /** - * Generates the correct `XMLHttpRequest` for regular and cross domain requests. - * - * @param {Boolean} [xdomain] Create a request that can be used cross domain. - * @returns {XMLHttpRequest|false} If we can create a XMLHttpRequest. - * @api private - */ - - util.request = function (xdomain) { - - if (xdomain && 'undefined' != typeof XDomainRequest && !util.ua.hasCORS) { - return new XDomainRequest(); - } - - if ('undefined' != typeof XMLHttpRequest && (!xdomain || util.ua.hasCORS)) { - return new XMLHttpRequest(); - } - - if (!xdomain) { - try { - return new window[(['Active'].concat('Object').join('X'))]('Microsoft.XMLHTTP'); - } catch(e) { } - } - - return null; - }; - - /** - * XHR based transport constructor. - * - * @constructor - * @api public - */ - - /** - * Change the internal pageLoaded value. - */ - - if ('undefined' != typeof window) { - util.load(function () { - pageLoaded = true; - }); - } - - /** - * Defers a function to ensure a spinner is not displayed by the browser - * - * @param {Function} fn - * @api public - */ - - util.defer = function (fn) { - if (!util.ua.webkit || 'undefined' != typeof importScripts) { - return fn(); - } - - util.load(function () { - setTimeout(fn, 100); - }); - }; - - /** - * Merges two objects. - * - * @api public - */ - - util.merge = function merge (target, additional, deep, lastseen) { - var seen = lastseen || [] - , depth = typeof deep == 'undefined' ? 2 : deep - , prop; - - for (prop in additional) { - if (additional.hasOwnProperty(prop) && util.indexOf(seen, prop) < 0) { - if (typeof target[prop] !== 'object' || !depth) { - target[prop] = additional[prop]; - seen.push(additional[prop]); - } else { - util.merge(target[prop], additional[prop], depth - 1, seen); - } - } - } - - return target; - }; - - /** - * Merges prototypes from objects - * - * @api public - */ - - util.mixin = function (ctor, ctor2) { - util.merge(ctor.prototype, ctor2.prototype); - }; - - /** - * Shortcut for prototypical and static inheritance. - * - * @api private - */ - - util.inherit = function (ctor, ctor2) { - function f() {}; - f.prototype = ctor2.prototype; - ctor.prototype = new f; - }; - - /** - * Checks if the given object is an Array. - * - * io.util.isArray([]); // true - * io.util.isArray({}); // false - * - * @param Object obj - * @api public - */ - - util.isArray = Array.isArray || function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - /** - * Intersects values of two arrays into a third - * - * @api public - */ - - util.intersect = function (arr, arr2) { - var ret = [] - , longest = arr.length > arr2.length ? arr : arr2 - , shortest = arr.length > arr2.length ? arr2 : arr; - - for (var i = 0, l = shortest.length; i < l; i++) { - if (~util.indexOf(longest, shortest[i])) - ret.push(shortest[i]); - } - - return ret; - }; - - /** - * Array indexOf compatibility. - * - * @see bit.ly/a5Dxa2 - * @api public - */ - - util.indexOf = function (arr, o, i) { - - for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0; - i < j && arr[i] !== o; i++) {} - - return j <= i ? -1 : i; - }; - - /** - * Converts enumerables to array. - * - * @api public - */ - - util.toArray = function (enu) { - var arr = []; - - for (var i = 0, l = enu.length; i < l; i++) - arr.push(enu[i]); - - return arr; - }; - - /** - * UA / engines detection namespace. - * - * @namespace - */ - - util.ua = {}; - - /** - * Whether the UA supports CORS for XHR. - * - * @api public - */ - - util.ua.hasCORS = 'undefined' != typeof XMLHttpRequest && (function () { - try { - var a = new XMLHttpRequest(); - } catch (e) { - return false; - } - - return a.withCredentials != undefined; - })(); - - /** - * Detect webkit. - * - * @api public - */ - - util.ua.webkit = 'undefined' != typeof navigator - && /webkit/i.test(navigator.userAgent); - - /** - * Detect iPad/iPhone/iPod. - * - * @api public - */ - - util.ua.iDevice = 'undefined' != typeof navigator - && /iPad|iPhone|iPod/i.test(navigator.userAgent); - -})('undefined' != typeof io ? io : module.exports, this); -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io) { - - /** - * Expose constructor. - */ - - exports.EventEmitter = EventEmitter; - - /** - * Event emitter constructor. - * - * @api public. - */ - - function EventEmitter () {}; - - /** - * Adds a listener - * - * @api public - */ - - EventEmitter.prototype.on = function (name, fn) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = fn; - } else if (io.util.isArray(this.$events[name])) { - this.$events[name].push(fn); - } else { - this.$events[name] = [this.$events[name], fn]; - } - - return this; - }; - - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - /** - * Adds a volatile listener. - * - * @api public - */ - - EventEmitter.prototype.once = function (name, fn) { - var self = this; - - function on () { - self.removeListener(name, on); - fn.apply(this, arguments); - }; - - on.listener = fn; - this.on(name, on); - - return this; - }; - - /** - * Removes a listener. - * - * @api public - */ - - EventEmitter.prototype.removeListener = function (name, fn) { - if (this.$events && this.$events[name]) { - var list = this.$events[name]; - - if (io.util.isArray(list)) { - var pos = -1; - - for (var i = 0, l = list.length; i < l; i++) { - if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { - pos = i; - break; - } - } - - if (pos < 0) { - return this; - } - - list.splice(pos, 1); - - if (!list.length) { - delete this.$events[name]; - } - } else if (list === fn || (list.listener && list.listener === fn)) { - delete this.$events[name]; - } - } - - return this; - }; - - /** - * Removes all listeners for an event. - * - * @api public - */ - - EventEmitter.prototype.removeAllListeners = function (name) { - if (name === undefined) { - this.$events = {}; - return this; - } - - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } - - return this; - }; - - /** - * Gets all listeners for a certain event. - * - * @api publci - */ - - EventEmitter.prototype.listeners = function (name) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = []; - } - - if (!io.util.isArray(this.$events[name])) { - this.$events[name] = [this.$events[name]]; - } - - return this.$events[name]; - }; - - /** - * Emits an event. - * - * @api public - */ - - EventEmitter.prototype.emit = function (name) { - if (!this.$events) { - return false; - } - - var handler = this.$events[name]; - - if (!handler) { - return false; - } - - var args = Array.prototype.slice.call(arguments, 1); - - if ('function' == typeof handler) { - handler.apply(this, args); - } else if (io.util.isArray(handler)) { - var listeners = handler.slice(); - - for (var i = 0, l = listeners.length; i < l; i++) { - listeners[i].apply(this, args); - } - } else { - return false; - } - - return true; - }; - -})( - 'undefined' != typeof io ? io : module.exports - , 'undefined' != typeof io ? io : module.parent.exports -); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Based on JSON2 (http://www.JSON.org/js.html). - */ - -(function (exports, nativeJSON) { - "use strict"; - - // use native JSON if it's available - if (nativeJSON && nativeJSON.parse){ - return exports.JSON = { - parse: nativeJSON.parse - , stringify: nativeJSON.stringify - }; - } - - var JSON = exports.JSON = {}; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - function date(d, key) { - return isFinite(d.valueOf()) ? - d.getUTCFullYear() + '-' + - f(d.getUTCMonth() + 1) + '-' + - f(d.getUTCDate()) + 'T' + - f(d.getUTCHours()) + ':' + - f(d.getUTCMinutes()) + ':' + - f(d.getUTCSeconds()) + 'Z' : null; - }; - - 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 instanceof Date) { - value = date(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) { - if (typeof rep[i] === 'string') { - k = rep[i]; - 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.prototype.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. - - 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. - - 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.prototype.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'); - }; - -})( - 'undefined' != typeof io ? io : module.exports - , typeof JSON !== 'undefined' ? JSON : undefined -); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io) { - - /** - * Parser namespace. - * - * @namespace - */ - - var parser = exports.parser = {}; - - /** - * Packet types. - */ - - var packets = parser.packets = [ - 'disconnect' - , 'connect' - , 'heartbeat' - , 'message' - , 'json' - , 'event' - , 'ack' - , 'error' - , 'noop' - ]; - - /** - * Errors reasons. - */ - - var reasons = parser.reasons = [ - 'transport not supported' - , 'client not handshaken' - , 'unauthorized' - ]; - - /** - * Errors advice. - */ - - var advice = parser.advice = [ - 'reconnect' - ]; - - /** - * Shortcuts. - */ - - var JSON = io.JSON - , indexOf = io.util.indexOf; - - /** - * Encodes a packet. - * - * @api private - */ - - parser.encodePacket = function (packet) { - var type = indexOf(packets, packet.type) - , id = packet.id || '' - , endpoint = packet.endpoint || '' - , ack = packet.ack - , data = null; - - switch (packet.type) { - case 'error': - var reason = packet.reason ? indexOf(reasons, packet.reason) : '' - , adv = packet.advice ? indexOf(advice, packet.advice) : ''; - - if (reason !== '' || adv !== '') - data = reason + (adv !== '' ? ('+' + adv) : ''); - - break; - - case 'message': - if (packet.data !== '') - data = packet.data; - break; - - case 'event': - var ev = { name: packet.name }; - - if (packet.args && packet.args.length) { - ev.args = packet.args; - } - - data = JSON.stringify(ev); - break; - - case 'json': - data = JSON.stringify(packet.data); - break; - - case 'connect': - if (packet.qs) - data = packet.qs; - break; - - case 'ack': - data = packet.ackId - + (packet.args && packet.args.length - ? '+' + JSON.stringify(packet.args) : ''); - break; - } - - // construct packet with required fragments - var encoded = [ - type - , id + (ack == 'data' ? '+' : '') - , endpoint - ]; - - // data fragment is optional - if (data !== null && data !== undefined) - encoded.push(data); - - return encoded.join(':'); - }; - - /** - * Encodes multiple messages (payload). - * - * @param {Array} messages - * @api private - */ - - parser.encodePayload = function (packets) { - var decoded = ''; - - if (packets.length == 1) - return packets[0]; - - for (var i = 0, l = packets.length; i < l; i++) { - var packet = packets[i]; - decoded += '\ufffd' + packet.length + '\ufffd' + packets[i]; - } - - return decoded; - }; - - /** - * Decodes a packet - * - * @api private - */ - - var regexp = /([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/; - - parser.decodePacket = function (data) { - var pieces = data.match(regexp); - - if (!pieces) return {}; - - var id = pieces[2] || '' - , data = pieces[5] || '' - , packet = { - type: packets[pieces[1]] - , endpoint: pieces[4] || '' - }; - - // whether we need to acknowledge the packet - if (id) { - packet.id = id; - if (pieces[3]) - packet.ack = 'data'; - else - packet.ack = true; - } - - // handle different packet types - switch (packet.type) { - case 'error': - var pieces = data.split('+'); - packet.reason = reasons[pieces[0]] || ''; - packet.advice = advice[pieces[1]] || ''; - break; - - case 'message': - packet.data = data || ''; - break; - - case 'event': - try { - var opts = JSON.parse(data); - packet.name = opts.name; - packet.args = opts.args; - } catch (e) { } - - packet.args = packet.args || []; - break; - - case 'json': - try { - packet.data = JSON.parse(data); - } catch (e) { } - break; - - case 'connect': - packet.qs = data || ''; - break; - - case 'ack': - var pieces = data.match(/^([0-9]+)(\+)?(.*)/); - if (pieces) { - packet.ackId = pieces[1]; - packet.args = []; - - if (pieces[3]) { - try { - packet.args = pieces[3] ? JSON.parse(pieces[3]) : []; - } catch (e) { } - } - } - break; - - case 'disconnect': - case 'heartbeat': - break; - }; - - return packet; - }; - - /** - * Decodes data payload. Detects multiple messages - * - * @return {Array} messages - * @api public - */ - - parser.decodePayload = function (data) { - // IE doesn't like data[i] for unicode chars, charAt works fine - if (data.charAt(0) == '\ufffd') { - var ret = []; - - for (var i = 1, length = ''; i < data.length; i++) { - if (data.charAt(i) == '\ufffd') { - ret.push(parser.decodePacket(data.substr(i + 1).substr(0, length))); - i += Number(length) + 1; - length = ''; - } else { - length += data.charAt(i); - } - } - - return ret; - } else { - return [parser.decodePacket(data)]; - } - }; - -})( - 'undefined' != typeof io ? io : module.exports - , 'undefined' != typeof io ? io : module.parent.exports -); -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io) { - - /** - * Expose constructor. - */ - - exports.Transport = Transport; - - /** - * This is the transport template for all supported transport methods. - * - * @constructor - * @api public - */ - - function Transport (socket, sessid) { - this.socket = socket; - this.sessid = sessid; - }; - - /** - * Apply EventEmitter mixin. - */ - - io.util.mixin(Transport, io.EventEmitter); - - - /** - * Indicates whether heartbeats is enabled for this transport - * - * @api private - */ - - Transport.prototype.heartbeats = function () { - return true; - }; - - /** - * Handles the response from the server. When a new response is received - * it will automatically update the timeout, decode the message and - * forwards the response to the onMessage function for further processing. - * - * @param {String} data Response from the server. - * @api private - */ - - Transport.prototype.onData = function (data) { - this.clearCloseTimeout(); - - // If the connection in currently open (or in a reopening state) reset the close - // timeout since we have just received data. This check is necessary so - // that we don't reset the timeout on an explicitly disconnected connection. - if (this.socket.connected || this.socket.connecting || this.socket.reconnecting) { - this.setCloseTimeout(); - } - - if (data !== '') { - // todo: we should only do decodePayload for xhr transports - var msgs = io.parser.decodePayload(data); - - if (msgs && msgs.length) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.onPacket(msgs[i]); - } - } - } - - return this; - }; - - /** - * Handles packets. - * - * @api private - */ - - Transport.prototype.onPacket = function (packet) { - this.socket.setHeartbeatTimeout(); - - if (packet.type == 'heartbeat') { - return this.onHeartbeat(); - } - - if (packet.type == 'connect' && packet.endpoint == '') { - this.onConnect(); - } - - if (packet.type == 'error' && packet.advice == 'reconnect') { - this.isOpen = false; - } - - this.socket.onPacket(packet); - - return this; - }; - - /** - * Sets close timeout - * - * @api private - */ - - Transport.prototype.setCloseTimeout = function () { - if (!this.closeTimeout) { - var self = this; - - this.closeTimeout = setTimeout(function () { - self.onDisconnect(); - }, this.socket.closeTimeout); - } - }; - - /** - * Called when transport disconnects. - * - * @api private - */ - - Transport.prototype.onDisconnect = function () { - if (this.isOpen) this.close(); - this.clearTimeouts(); - this.socket.onDisconnect(); - return this; - }; - - /** - * Called when transport connects - * - * @api private - */ - - Transport.prototype.onConnect = function () { - this.socket.onConnect(); - return this; - }; - - /** - * Clears close timeout - * - * @api private - */ - - Transport.prototype.clearCloseTimeout = function () { - if (this.closeTimeout) { - clearTimeout(this.closeTimeout); - this.closeTimeout = null; - } - }; - - /** - * Clear timeouts - * - * @api private - */ - - Transport.prototype.clearTimeouts = function () { - this.clearCloseTimeout(); - - if (this.reopenTimeout) { - clearTimeout(this.reopenTimeout); - } - }; - - /** - * Sends a packet - * - * @param {Object} packet object. - * @api private - */ - - Transport.prototype.packet = function (packet) { - this.send(io.parser.encodePacket(packet)); - }; - - /** - * Send the received heartbeat message back to server. So the server - * knows we are still connected. - * - * @param {String} heartbeat Heartbeat response from the server. - * @api private - */ - - Transport.prototype.onHeartbeat = function (heartbeat) { - this.packet({ type: 'heartbeat' }); - }; - - /** - * Called when the transport opens. - * - * @api private - */ - - Transport.prototype.onOpen = function () { - this.isOpen = true; - this.clearCloseTimeout(); - this.socket.onOpen(); - }; - - /** - * Notifies the base when the connection with the Socket.IO server - * has been disconnected. - * - * @api private - */ - - Transport.prototype.onClose = function () { - var self = this; - - /* FIXME: reopen delay causing a infinit loop - this.reopenTimeout = setTimeout(function () { - self.open(); - }, this.socket.options['reopen delay']);*/ - - this.isOpen = false; - this.socket.onClose(); - this.onDisconnect(); - }; - - /** - * Generates a connection url based on the Socket.IO URL Protocol. - * See for more details. - * - * @returns {String} Connection url - * @api private - */ - - Transport.prototype.prepareUrl = function () { - var options = this.socket.options; - - return this.scheme() + '://' - + options.host + ':' + options.port + '/' - + options.resource + '/' + io.protocol - + '/' + this.name + '/' + this.sessid; - }; - - /** - * Checks if the transport is ready to start a connection. - * - * @param {Socket} socket The socket instance that needs a transport - * @param {Function} fn The callback - * @api private - */ - - Transport.prototype.ready = function (socket, fn) { - fn.call(this); - }; -})( - 'undefined' != typeof io ? io : module.exports - , 'undefined' != typeof io ? io : module.parent.exports -); -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io, global) { - - /** - * Expose constructor. - */ - - exports.Socket = Socket; - - /** - * Create a new `Socket.IO client` which can establish a persistent - * connection with a Socket.IO enabled server. - * - * @api public - */ - - function Socket (options) { - this.options = { - port: 80 - , secure: false - , document: 'document' in global ? document : false - , resource: 'socket.io' - , transports: io.transports - , 'connect timeout': 10000 - , 'try multiple transports': true - , 'reconnect': true - , 'reconnection delay': 500 - , 'reconnection limit': Infinity - , 'reopen delay': 3000 - , 'max reconnection attempts': 10 - , 'sync disconnect on unload': false - , 'auto connect': true - , 'flash policy port': 10843 - , 'manualFlush': false - }; - - io.util.merge(this.options, options); - - this.connected = false; - this.open = false; - this.connecting = false; - this.reconnecting = false; - this.namespaces = {}; - this.buffer = []; - this.doBuffer = false; - - if (this.options['sync disconnect on unload'] && - (!this.isXDomain() || io.util.ua.hasCORS)) { - var self = this; - io.util.on(global, 'beforeunload', function () { - self.disconnectSync(); - }, false); - } - - if (this.options['auto connect']) { - this.connect(); - } -}; - - /** - * Apply EventEmitter mixin. - */ - - io.util.mixin(Socket, io.EventEmitter); - - /** - * Returns a namespace listener/emitter for this socket - * - * @api public - */ - - Socket.prototype.of = function (name) { - if (!this.namespaces[name]) { - this.namespaces[name] = new io.SocketNamespace(this, name); - - if (name !== '') { - this.namespaces[name].packet({ type: 'connect' }); - } - } - - return this.namespaces[name]; - }; - - /** - * Emits the given event to the Socket and all namespaces - * - * @api private - */ - - Socket.prototype.publish = function () { - this.emit.apply(this, arguments); - - var nsp; - - for (var i in this.namespaces) { - if (this.namespaces.hasOwnProperty(i)) { - nsp = this.of(i); - nsp.$emit.apply(nsp, arguments); - } - } - }; - - /** - * Performs the handshake - * - * @api private - */ - - function empty () { }; - - Socket.prototype.handshake = function (fn) { - var self = this - , options = this.options; - - function complete (data) { - if (data instanceof Error) { - self.connecting = false; - self.onError(data.message); - } else { - fn.apply(null, data.split(':')); - } - }; - - var url = [ - 'http' + (options.secure ? 's' : '') + ':/' - , options.host + ':' + options.port - , options.resource - , io.protocol - , io.util.query(this.options.query, 't=' + +new Date) - ].join('/'); - - if (this.isXDomain() && !io.util.ua.hasCORS) { - var insertAt = document.getElementsByTagName('script')[0] - , script = document.createElement('script'); - - script.src = url + '&jsonp=' + io.j.length; - insertAt.parentNode.insertBefore(script, insertAt); - - io.j.push(function (data) { - complete(data); - script.parentNode.removeChild(script); - }); - } else { - var xhr = io.util.request(); - - xhr.open('GET', url, true); - if (this.isXDomain()) { - xhr.withCredentials = true; - } - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - xhr.onreadystatechange = empty; - - if (xhr.status == 200) { - complete(xhr.responseText); - } else if (xhr.status == 403) { - self.onError(xhr.responseText); - } else { - self.connecting = false; - !self.reconnecting && self.onError(xhr.responseText); - } - } - }; - xhr.send(null); - } - }; - - /** - * Find an available transport based on the options supplied in the constructor. - * - * @api private - */ - - Socket.prototype.getTransport = function (override) { - var transports = override || this.transports, match; - - for (var i = 0, transport; transport = transports[i]; i++) { - if (io.Transport[transport] - && io.Transport[transport].check(this) - && (!this.isXDomain() || io.Transport[transport].xdomainCheck(this))) { - return new io.Transport[transport](this, this.sessionid); - } - } - - return null; - }; - - /** - * Connects to the server. - * - * @param {Function} [fn] Callback. - * @returns {io.Socket} - * @api public - */ - - Socket.prototype.connect = function (fn) { - if (this.connecting) { - return this; - } - - var self = this; - self.connecting = true; - - this.handshake(function (sid, heartbeat, close, transports) { - self.sessionid = sid; - self.closeTimeout = close * 1000; - self.heartbeatTimeout = heartbeat * 1000; - if(!self.transports) - self.transports = self.origTransports = (transports ? io.util.intersect( - transports.split(',') - , self.options.transports - ) : self.options.transports); - - self.setHeartbeatTimeout(); - - function connect (transports){ - if (self.transport) self.transport.clearTimeouts(); - - self.transport = self.getTransport(transports); - if (!self.transport) return self.publish('connect_failed'); - - // once the transport is ready - self.transport.ready(self, function () { - self.connecting = true; - self.publish('connecting', self.transport.name); - self.transport.open(); - - if (self.options['connect timeout']) { - self.connectTimeoutTimer = setTimeout(function () { - if (!self.connected) { - self.connecting = false; - - if (self.options['try multiple transports']) { - var remaining = self.transports; - - while (remaining.length > 0 && remaining.splice(0,1)[0] != - self.transport.name) {} - - if (remaining.length){ - connect(remaining); - } else { - self.publish('connect_failed'); - } - } - } - }, self.options['connect timeout']); - } - }); - } - - connect(self.transports); - - self.once('connect', function (){ - clearTimeout(self.connectTimeoutTimer); - - fn && typeof fn == 'function' && fn(); - }); - }); - - return this; - }; - - /** - * Clears and sets a new heartbeat timeout using the value given by the - * server during the handshake. - * - * @api private - */ - - Socket.prototype.setHeartbeatTimeout = function () { - clearTimeout(this.heartbeatTimeoutTimer); - if(this.transport && !this.transport.heartbeats()) return; - - var self = this; - this.heartbeatTimeoutTimer = setTimeout(function () { - self.transport.onClose(); - }, this.heartbeatTimeout); - }; - - /** - * Sends a message. - * - * @param {Object} data packet. - * @returns {io.Socket} - * @api public - */ - - Socket.prototype.packet = function (data) { - if (this.connected && !this.doBuffer) { - this.transport.packet(data); - } else { - this.buffer.push(data); - } - - return this; - }; - - /** - * Sets buffer state - * - * @api private - */ - - Socket.prototype.setBuffer = function (v) { - this.doBuffer = v; - - if (!v && this.connected && this.buffer.length) { - if (!this.options['manualFlush']) { - this.flushBuffer(); - } - } - }; - - /** - * Flushes the buffer data over the wire. - * To be invoked manually when 'manualFlush' is set to true. - * - * @api public - */ - - Socket.prototype.flushBuffer = function() { - this.transport.payload(this.buffer); - this.buffer = []; - }; - - - /** - * Disconnect the established connect. - * - * @returns {io.Socket} - * @api public - */ - - Socket.prototype.disconnect = function () { - if (this.connected || this.connecting) { - if (this.open) { - this.of('').packet({ type: 'disconnect' }); - } - - // handle disconnection immediately - this.onDisconnect('booted'); - } - - return this; - }; - - /** - * Disconnects the socket with a sync XHR. - * - * @api private - */ - - Socket.prototype.disconnectSync = function () { - // ensure disconnection - var xhr = io.util.request(); - var uri = [ - 'http' + (this.options.secure ? 's' : '') + ':/' - , this.options.host + ':' + this.options.port - , this.options.resource - , io.protocol - , '' - , this.sessionid - ].join('/') + '/?disconnect=1'; - - xhr.open('GET', uri, false); - xhr.send(null); - - // handle disconnection immediately - this.onDisconnect('booted'); - }; - - /** - * Check if we need to use cross domain enabled transports. Cross domain would - * be a different port or different domain name. - * - * @returns {Boolean} - * @api private - */ - - Socket.prototype.isXDomain = function () { - - var port = global.location.port || - ('https:' == global.location.protocol ? 443 : 80); - - return this.options.host !== global.location.hostname - || this.options.port != port; - }; - - /** - * Called upon handshake. - * - * @api private - */ - - Socket.prototype.onConnect = function () { - if (!this.connected) { - this.connected = true; - this.connecting = false; - if (!this.doBuffer) { - // make sure to flush the buffer - this.setBuffer(false); - } - this.emit('connect'); - } - }; - - /** - * Called when the transport opens - * - * @api private - */ - - Socket.prototype.onOpen = function () { - this.open = true; - }; - - /** - * Called when the transport closes. - * - * @api private - */ - - Socket.prototype.onClose = function () { - this.open = false; - clearTimeout(this.heartbeatTimeoutTimer); - }; - - /** - * Called when the transport first opens a connection - * - * @param text - */ - - Socket.prototype.onPacket = function (packet) { - this.of(packet.endpoint).onPacket(packet); - }; - - /** - * Handles an error. - * - * @api private - */ - - Socket.prototype.onError = function (err) { - if (err && err.advice) { - if (err.advice === 'reconnect' && (this.connected || this.connecting)) { - this.disconnect(); - if (this.options.reconnect) { - this.reconnect(); - } - } - } - - this.publish('error', err && err.reason ? err.reason : err); - }; - - /** - * Called when the transport disconnects. - * - * @api private - */ - - Socket.prototype.onDisconnect = function (reason) { - var wasConnected = this.connected - , wasConnecting = this.connecting; - - this.connected = false; - this.connecting = false; - this.open = false; - - if (wasConnected || wasConnecting) { - this.transport.close(); - this.transport.clearTimeouts(); - if (wasConnected) { - this.publish('disconnect', reason); - - if ('booted' != reason && this.options.reconnect && !this.reconnecting) { - this.reconnect(); - } - } - } - }; - - /** - * Called upon reconnection. - * - * @api private - */ - - Socket.prototype.reconnect = function () { - this.reconnecting = true; - this.reconnectionAttempts = 0; - this.reconnectionDelay = this.options['reconnection delay']; - - var self = this - , maxAttempts = this.options['max reconnection attempts'] - , tryMultiple = this.options['try multiple transports'] - , limit = this.options['reconnection limit']; - - function reset () { - if (self.connected) { - for (var i in self.namespaces) { - if (self.namespaces.hasOwnProperty(i) && '' !== i) { - self.namespaces[i].packet({ type: 'connect' }); - } - } - self.publish('reconnect', self.transport.name, self.reconnectionAttempts); - } - - clearTimeout(self.reconnectionTimer); - - self.removeListener('connect_failed', maybeReconnect); - self.removeListener('connect', maybeReconnect); - - self.reconnecting = false; - - delete self.reconnectionAttempts; - delete self.reconnectionDelay; - delete self.reconnectionTimer; - delete self.redoTransports; - - self.options['try multiple transports'] = tryMultiple; - }; - - function maybeReconnect () { - if (!self.reconnecting) { - return; - } - - if (self.connected) { - return reset(); - }; - - if (self.connecting && self.reconnecting) { - return self.reconnectionTimer = setTimeout(maybeReconnect, 1000); - } - - if (self.reconnectionAttempts++ >= maxAttempts) { - if (!self.redoTransports) { - self.on('connect_failed', maybeReconnect); - self.options['try multiple transports'] = true; - self.transports = self.origTransports; - self.transport = self.getTransport(); - self.redoTransports = true; - self.connect(); - } else { - self.publish('reconnect_failed'); - reset(); - } - } else { - if (self.reconnectionDelay < limit) { - self.reconnectionDelay *= 2; // exponential back off - } - - self.connect(); - self.publish('reconnecting', self.reconnectionDelay, self.reconnectionAttempts); - self.reconnectionTimer = setTimeout(maybeReconnect, self.reconnectionDelay); - } - }; - - this.options['try multiple transports'] = false; - this.reconnectionTimer = setTimeout(maybeReconnect, this.reconnectionDelay); - - this.on('connect', maybeReconnect); - }; - -})( - 'undefined' != typeof io ? io : module.exports - , 'undefined' != typeof io ? io : module.parent.exports - , this -); -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io) { - - /** - * Expose constructor. - */ - - exports.SocketNamespace = SocketNamespace; - - /** - * Socket namespace constructor. - * - * @constructor - * @api public - */ - - function SocketNamespace (socket, name) { - this.socket = socket; - this.name = name || ''; - this.flags = {}; - this.json = new Flag(this, 'json'); - this.ackPackets = 0; - this.acks = {}; - }; - - /** - * Apply EventEmitter mixin. - */ - - io.util.mixin(SocketNamespace, io.EventEmitter); - - /** - * Copies emit since we override it - * - * @api private - */ - - SocketNamespace.prototype.$emit = io.EventEmitter.prototype.emit; - - /** - * Creates a new namespace, by proxying the request to the socket. This - * allows us to use the synax as we do on the server. - * - * @api public - */ - - SocketNamespace.prototype.of = function () { - return this.socket.of.apply(this.socket, arguments); - }; - - /** - * Sends a packet. - * - * @api private - */ - - SocketNamespace.prototype.packet = function (packet) { - packet.endpoint = this.name; - this.socket.packet(packet); - this.flags = {}; - return this; - }; - - /** - * Sends a message - * - * @api public - */ - - SocketNamespace.prototype.send = function (data, fn) { - var packet = { - type: this.flags.json ? 'json' : 'message' - , data: data - }; - - if ('function' == typeof fn) { - packet.id = ++this.ackPackets; - packet.ack = true; - this.acks[packet.id] = fn; - } - - return this.packet(packet); - }; - - /** - * Emits an event - * - * @api public - */ - - SocketNamespace.prototype.emit = function (name) { - var args = Array.prototype.slice.call(arguments, 1) - , lastArg = args[args.length - 1] - , packet = { - type: 'event' - , name: name - }; - - if ('function' == typeof lastArg) { - packet.id = ++this.ackPackets; - packet.ack = 'data'; - this.acks[packet.id] = lastArg; - args = args.slice(0, args.length - 1); - } - - packet.args = args; - - return this.packet(packet); - }; - - /** - * Disconnects the namespace - * - * @api private - */ - - SocketNamespace.prototype.disconnect = function () { - if (this.name === '') { - this.socket.disconnect(); - } else { - this.packet({ type: 'disconnect' }); - this.$emit('disconnect'); - } - - return this; - }; - - /** - * Handles a packet - * - * @api private - */ - - SocketNamespace.prototype.onPacket = function (packet) { - var self = this; - - function ack () { - self.packet({ - type: 'ack' - , args: io.util.toArray(arguments) - , ackId: packet.id - }); - }; - - switch (packet.type) { - case 'connect': - this.$emit('connect'); - break; - - case 'disconnect': - if (this.name === '') { - this.socket.onDisconnect(packet.reason || 'booted'); - } else { - this.$emit('disconnect', packet.reason); - } - break; - - case 'message': - case 'json': - var params = ['message', packet.data]; - - if (packet.ack == 'data') { - params.push(ack); - } else if (packet.ack) { - this.packet({ type: 'ack', ackId: packet.id }); - } - - this.$emit.apply(this, params); - break; - - case 'event': - var params = [packet.name].concat(packet.args); - - if (packet.ack == 'data') - params.push(ack); - - this.$emit.apply(this, params); - break; - - case 'ack': - if (this.acks[packet.ackId]) { - this.acks[packet.ackId].apply(this, packet.args); - delete this.acks[packet.ackId]; - } - break; - - case 'error': - if (packet.advice){ - this.socket.onError(packet); - } else { - if (packet.reason == 'unauthorized') { - this.$emit('connect_failed', packet.reason); - } else { - this.$emit('error', packet.reason); - } - } - break; - } - }; - - /** - * Flag interface. - * - * @api private - */ - - function Flag (nsp, name) { - this.namespace = nsp; - this.name = name; - }; - - /** - * Send a message - * - * @api public - */ - - Flag.prototype.send = function () { - this.namespace.flags[this.name] = true; - this.namespace.send.apply(this.namespace, arguments); - }; - - /** - * Emit an event - * - * @api public - */ - - Flag.prototype.emit = function () { - this.namespace.flags[this.name] = true; - this.namespace.emit.apply(this.namespace, arguments); - }; - -})( - 'undefined' != typeof io ? io : module.exports - , 'undefined' != typeof io ? io : module.parent.exports -); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io, global) { - - /** - * Expose constructor. - */ - - exports.websocket = WS; - - /** - * The WebSocket transport uses the HTML5 WebSocket API to establish an - * persistent connection with the Socket.IO server. This transport will also - * be inherited by the FlashSocket fallback as it provides a API compatible - * polyfill for the WebSockets. - * - * @constructor - * @extends {io.Transport} - * @api public - */ - - function WS (socket) { - io.Transport.apply(this, arguments); - }; - - /** - * Inherits from Transport. - */ - - io.util.inherit(WS, io.Transport); - - /** - * Transport name - * - * @api public - */ - - WS.prototype.name = 'websocket'; - - /** - * Initializes a new `WebSocket` connection with the Socket.IO server. We attach - * all the appropriate listeners to handle the responses from the server. - * - * @returns {Transport} - * @api public - */ - - WS.prototype.open = function () { - var query = io.util.query(this.socket.options.query) - , self = this - , Socket - - - if (!Socket) { - Socket = global.MozWebSocket || global.WebSocket; - } - - this.websocket = new Socket(this.prepareUrl() + query); - - this.websocket.onopen = function () { - self.onOpen(); - self.socket.setBuffer(false); - }; - this.websocket.onmessage = function (ev) { - self.onData(ev.data); - }; - this.websocket.onclose = function () { - self.onClose(); - self.socket.setBuffer(true); - }; - this.websocket.onerror = function (e) { - self.onError(e); - }; - - return this; - }; - - /** - * Send a message to the Socket.IO server. The message will automatically be - * encoded in the correct message format. - * - * @returns {Transport} - * @api public - */ - - // Do to a bug in the current IDevices browser, we need to wrap the send in a - // setTimeout, when they resume from sleeping the browser will crash if - // we don't allow the browser time to detect the socket has been closed - if (io.util.ua.iDevice) { - WS.prototype.send = function (data) { - var self = this; - setTimeout(function() { - self.websocket.send(data); - },0); - return this; - }; - } else { - WS.prototype.send = function (data) { - this.websocket.send(data); - return this; - }; - } - - /** - * Payload - * - * @api private - */ - - WS.prototype.payload = function (arr) { - for (var i = 0, l = arr.length; i < l; i++) { - this.packet(arr[i]); - } - return this; - }; - - /** - * Disconnect the established `WebSocket` connection. - * - * @returns {Transport} - * @api public - */ - - WS.prototype.close = function () { - this.websocket.close(); - return this; - }; - - /** - * Handle the errors that `WebSocket` might be giving when we - * are attempting to connect or send messages. - * - * @param {Error} e The error. - * @api private - */ - - WS.prototype.onError = function (e) { - this.socket.onError(e); - }; - - /** - * Returns the appropriate scheme for the URI generation. - * - * @api private - */ - WS.prototype.scheme = function () { - return this.socket.options.secure ? 'wss' : 'ws'; - }; - - /** - * Checks if the browser has support for native `WebSockets` and that - * it's not the polyfill created for the FlashSocket transport. - * - * @return {Boolean} - * @api public - */ - - WS.check = function () { - return ('WebSocket' in global && !('__addTask' in WebSocket)) - || 'MozWebSocket' in global; - }; - - /** - * Check if the `WebSocket` transport support cross domain communications. - * - * @returns {Boolean} - * @api public - */ - - WS.xdomainCheck = function () { - return true; - }; - - /** - * Add the transport to your public io.transports array. - * - * @api private - */ - - io.transports.push('websocket'); - -})( - 'undefined' != typeof io ? io.Transport : module.exports - , 'undefined' != typeof io ? io : module.parent.exports - , this -); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io) { - - /** - * Expose constructor. - */ - - exports.flashsocket = Flashsocket; - - /** - * The FlashSocket transport. This is a API wrapper for the HTML5 WebSocket - * specification. It uses a .swf file to communicate with the server. If you want - * to serve the .swf file from a other server than where the Socket.IO script is - * coming from you need to use the insecure version of the .swf. More information - * about this can be found on the github page. - * - * @constructor - * @extends {io.Transport.websocket} - * @api public - */ - - function Flashsocket () { - io.Transport.websocket.apply(this, arguments); - }; - - /** - * Inherits from Transport. - */ - - io.util.inherit(Flashsocket, io.Transport.websocket); - - /** - * Transport name - * - * @api public - */ - - Flashsocket.prototype.name = 'flashsocket'; - - /** - * Disconnect the established `FlashSocket` connection. This is done by adding a - * new task to the FlashSocket. The rest will be handled off by the `WebSocket` - * transport. - * - * @returns {Transport} - * @api public - */ - - Flashsocket.prototype.open = function () { - var self = this - , args = arguments; - - WebSocket.__addTask(function () { - io.Transport.websocket.prototype.open.apply(self, args); - }); - return this; - }; - - /** - * Sends a message to the Socket.IO server. This is done by adding a new - * task to the FlashSocket. The rest will be handled off by the `WebSocket` - * transport. - * - * @returns {Transport} - * @api public - */ - - Flashsocket.prototype.send = function () { - var self = this, args = arguments; - WebSocket.__addTask(function () { - io.Transport.websocket.prototype.send.apply(self, args); - }); - return this; - }; - - /** - * Disconnects the established `FlashSocket` connection. - * - * @returns {Transport} - * @api public - */ - - Flashsocket.prototype.close = function () { - WebSocket.__tasks.length = 0; - io.Transport.websocket.prototype.close.call(this); - return this; - }; - - /** - * The WebSocket fall back needs to append the flash container to the body - * element, so we need to make sure we have access to it. Or defer the call - * until we are sure there is a body element. - * - * @param {Socket} socket The socket instance that needs a transport - * @param {Function} fn The callback - * @api private - */ - - Flashsocket.prototype.ready = function (socket, fn) { - function init () { - var options = socket.options - , port = options['flash policy port'] - , path = [ - 'http' + (options.secure ? 's' : '') + ':/' - , options.host + ':' + options.port - , options.resource - , 'static/flashsocket' - , 'WebSocketMain' + (socket.isXDomain() ? 'Insecure' : '') + '.swf' - ]; - - // Only start downloading the swf file when the checked that this browser - // actually supports it - if (!Flashsocket.loaded) { - if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined') { - // Set the correct file based on the XDomain settings - WEB_SOCKET_SWF_LOCATION = path.join('/'); - } - - if (port !== 843) { - WebSocket.loadFlashPolicyFile('xmlsocket://' + options.host + ':' + port); - } - - WebSocket.__initialize(); - Flashsocket.loaded = true; - } - - fn.call(self); - } - - var self = this; - if (document.body) return init(); - - io.util.load(init); - }; - - /** - * Check if the FlashSocket transport is supported as it requires that the Adobe - * Flash Player plug-in version `10.0.0` or greater is installed. And also check if - * the polyfill is correctly loaded. - * - * @returns {Boolean} - * @api public - */ - - Flashsocket.check = function () { - if ( - typeof WebSocket == 'undefined' - || !('__initialize' in WebSocket) || !swfobject - ) return false; - - return swfobject.getFlashPlayerVersion().major >= 10; - }; - - /** - * Check if the FlashSocket transport can be used as cross domain / cross origin - * transport. Because we can't see which type (secure or insecure) of .swf is used - * we will just return true. - * - * @returns {Boolean} - * @api public - */ - - Flashsocket.xdomainCheck = function () { - return true; - }; - - /** - * Disable AUTO_INITIALIZATION - */ - - if (typeof window != 'undefined') { - WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = true; - } - - /** - * Add the transport to your public io.transports array. - * - * @api private - */ - - io.transports.push('flashsocket'); -})( - 'undefined' != typeof io ? io.Transport : module.exports - , 'undefined' != typeof io ? io : module.parent.exports -); -/* SWFObject v2.2 - is released under the MIT License -*/ -if ('undefined' != typeof window) { -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O[(['Active'].concat('Object').join('X'))]!=D){try{var ad=new window[(['Active'].concat('Object').join('X'))](W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab -// License: New BSD License -// Reference: http://dev.w3.org/html5/websockets/ -// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol - -(function() { - - if ('undefined' == typeof window || window.WebSocket) return; - - var console = window.console; - if (!console || !console.log || !console.error) { - console = {log: function(){ }, error: function(){ }}; - } - - if (!swfobject.hasFlashPlayerVersion("10.0.0")) { - console.error("Flash Player >= 10.0.0 is required."); - return; - } - if (location.protocol == "file:") { - console.error( - "WARNING: web-socket-js doesn't work in file:///... URL " + - "unless you set Flash Security Settings properly. " + - "Open the page via Web server i.e. http://..."); - } - - /** - * This class represents a faux web socket. - * @param {string} url - * @param {array or string} protocols - * @param {string} proxyHost - * @param {int} proxyPort - * @param {string} headers - */ - WebSocket = function(url, protocols, proxyHost, proxyPort, headers) { - var self = this; - self.__id = WebSocket.__nextId++; - WebSocket.__instances[self.__id] = self; - self.readyState = WebSocket.CONNECTING; - self.bufferedAmount = 0; - self.__events = {}; - if (!protocols) { - protocols = []; - } else if (typeof protocols == "string") { - protocols = [protocols]; - } - // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc. - // Otherwise, when onopen fires immediately, onopen is called before it is set. - setTimeout(function() { - WebSocket.__addTask(function() { - WebSocket.__flash.create( - self.__id, url, protocols, proxyHost || null, proxyPort || 0, headers || null); - }); - }, 0); - }; - - /** - * Send data to the web socket. - * @param {string} data The data to send to the socket. - * @return {boolean} True for success, false for failure. - */ - WebSocket.prototype.send = function(data) { - if (this.readyState == WebSocket.CONNECTING) { - throw "INVALID_STATE_ERR: Web Socket connection has not been established"; - } - // We use encodeURIComponent() here, because FABridge doesn't work if - // the argument includes some characters. We don't use escape() here - // because of this: - // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions - // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't - // preserve all Unicode characters either e.g. "\uffff" in Firefox. - // Note by wtritch: Hopefully this will not be necessary using ExternalInterface. Will require - // additional testing. - var result = WebSocket.__flash.send(this.__id, encodeURIComponent(data)); - if (result < 0) { // success - return true; - } else { - this.bufferedAmount += result; - return false; - } - }; - - /** - * Close this web socket gracefully. - */ - WebSocket.prototype.close = function() { - if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) { - return; - } - this.readyState = WebSocket.CLOSING; - WebSocket.__flash.close(this.__id); - }; - - /** - * Implementation of {@link DOM 2 EventTarget Interface} - * - * @param {string} type - * @param {function} listener - * @param {boolean} useCapture - * @return void - */ - WebSocket.prototype.addEventListener = function(type, listener, useCapture) { - if (!(type in this.__events)) { - this.__events[type] = []; - } - this.__events[type].push(listener); - }; - - /** - * Implementation of {@link DOM 2 EventTarget Interface} - * - * @param {string} type - * @param {function} listener - * @param {boolean} useCapture - * @return void - */ - WebSocket.prototype.removeEventListener = function(type, listener, useCapture) { - if (!(type in this.__events)) return; - var events = this.__events[type]; - for (var i = events.length - 1; i >= 0; --i) { - if (events[i] === listener) { - events.splice(i, 1); - break; - } - } - }; - - /** - * Implementation of {@link DOM 2 EventTarget Interface} - * - * @param {Event} event - * @return void - */ - WebSocket.prototype.dispatchEvent = function(event) { - var events = this.__events[event.type] || []; - for (var i = 0; i < events.length; ++i) { - events[i](event); - } - var handler = this["on" + event.type]; - if (handler) handler(event); - }; - - /** - * Handles an event from Flash. - * @param {Object} flashEvent - */ - WebSocket.prototype.__handleEvent = function(flashEvent) { - if ("readyState" in flashEvent) { - this.readyState = flashEvent.readyState; - } - if ("protocol" in flashEvent) { - this.protocol = flashEvent.protocol; - } - - var jsEvent; - if (flashEvent.type == "open" || flashEvent.type == "error") { - jsEvent = this.__createSimpleEvent(flashEvent.type); - } else if (flashEvent.type == "close") { - // TODO implement jsEvent.wasClean - jsEvent = this.__createSimpleEvent("close"); - } else if (flashEvent.type == "message") { - var data = decodeURIComponent(flashEvent.message); - jsEvent = this.__createMessageEvent("message", data); - } else { - throw "unknown event type: " + flashEvent.type; - } - - this.dispatchEvent(jsEvent); - }; - - WebSocket.prototype.__createSimpleEvent = function(type) { - if (document.createEvent && window.Event) { - var event = document.createEvent("Event"); - event.initEvent(type, false, false); - return event; - } else { - return {type: type, bubbles: false, cancelable: false}; - } - }; - - WebSocket.prototype.__createMessageEvent = function(type, data) { - if (document.createEvent && window.MessageEvent && !window.opera) { - var event = document.createEvent("MessageEvent"); - event.initMessageEvent("message", false, false, data, null, null, window, null); - return event; - } else { - // IE and Opera, the latter one truncates the data parameter after any 0x00 bytes. - return {type: type, data: data, bubbles: false, cancelable: false}; - } - }; - - /** - * Define the WebSocket readyState enumeration. - */ - WebSocket.CONNECTING = 0; - WebSocket.OPEN = 1; - WebSocket.CLOSING = 2; - WebSocket.CLOSED = 3; - - WebSocket.__flash = null; - WebSocket.__instances = {}; - WebSocket.__tasks = []; - WebSocket.__nextId = 0; - - /** - * Load a new flash security policy file. - * @param {string} url - */ - WebSocket.loadFlashPolicyFile = function(url){ - WebSocket.__addTask(function() { - WebSocket.__flash.loadManualPolicyFile(url); - }); - }; - - /** - * Loads WebSocketMain.swf and creates WebSocketMain object in Flash. - */ - WebSocket.__initialize = function() { - if (WebSocket.__flash) return; - - if (WebSocket.__swfLocation) { - // For backword compatibility. - window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation; - } - if (!window.WEB_SOCKET_SWF_LOCATION) { - console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf"); - return; - } - var container = document.createElement("div"); - container.id = "webSocketContainer"; - // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents - // Flash from loading at least in IE. So we move it out of the screen at (-100, -100). - // But this even doesn't work with Flash Lite (e.g. in Droid Incredible). So with Flash - // Lite, we put it at (0, 0). This shows 1x1 box visible at left-top corner but this is - // the best we can do as far as we know now. - container.style.position = "absolute"; - if (WebSocket.__isFlashLite()) { - container.style.left = "0px"; - container.style.top = "0px"; - } else { - container.style.left = "-100px"; - container.style.top = "-100px"; - } - var holder = document.createElement("div"); - holder.id = "webSocketFlash"; - container.appendChild(holder); - document.body.appendChild(container); - // See this article for hasPriority: - // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html - swfobject.embedSWF( - WEB_SOCKET_SWF_LOCATION, - "webSocketFlash", - "1" /* width */, - "1" /* height */, - "10.0.0" /* SWF version */, - null, - null, - {hasPriority: true, swliveconnect : true, allowScriptAccess: "always"}, - null, - function(e) { - if (!e.success) { - console.error("[WebSocket] swfobject.embedSWF failed"); - } - }); - }; - - /** - * Called by Flash to notify JS that it's fully loaded and ready - * for communication. - */ - WebSocket.__onFlashInitialized = function() { - // We need to set a timeout here to avoid round-trip calls - // to flash during the initialization process. - setTimeout(function() { - WebSocket.__flash = document.getElementById("webSocketFlash"); - WebSocket.__flash.setCallerUrl(location.href); - WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG); - for (var i = 0; i < WebSocket.__tasks.length; ++i) { - WebSocket.__tasks[i](); - } - WebSocket.__tasks = []; - }, 0); - }; - - /** - * Called by Flash to notify WebSockets events are fired. - */ - WebSocket.__onFlashEvent = function() { - setTimeout(function() { - try { - // Gets events using receiveEvents() instead of getting it from event object - // of Flash event. This is to make sure to keep message order. - // It seems sometimes Flash events don't arrive in the same order as they are sent. - var events = WebSocket.__flash.receiveEvents(); - for (var i = 0; i < events.length; ++i) { - WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]); - } - } catch (e) { - console.error(e); - } - }, 0); - return true; - }; - - // Called by Flash. - WebSocket.__log = function(message) { - console.log(decodeURIComponent(message)); - }; - - // Called by Flash. - WebSocket.__error = function(message) { - console.error(decodeURIComponent(message)); - }; - - WebSocket.__addTask = function(task) { - if (WebSocket.__flash) { - task(); - } else { - WebSocket.__tasks.push(task); - } - }; - - /** - * Test if the browser is running flash lite. - * @return {boolean} True if flash lite is running, false otherwise. - */ - WebSocket.__isFlashLite = function() { - if (!window.navigator || !window.navigator.mimeTypes) { - return false; - } - var mimeType = window.navigator.mimeTypes["application/x-shockwave-flash"]; - if (!mimeType || !mimeType.enabledPlugin || !mimeType.enabledPlugin.filename) { - return false; - } - return mimeType.enabledPlugin.filename.match(/flashlite/i) ? true : false; - }; - - if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) { - if (window.addEventListener) { - window.addEventListener("load", function(){ - WebSocket.__initialize(); - }, false); - } else { - window.attachEvent("onload", function(){ - WebSocket.__initialize(); - }); - } - } - -})(); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io, global) { - - /** - * Expose constructor. - * - * @api public - */ - - exports.XHR = XHR; - - /** - * XHR constructor - * - * @costructor - * @api public - */ - - function XHR (socket) { - if (!socket) return; - - io.Transport.apply(this, arguments); - this.sendBuffer = []; - }; - - /** - * Inherits from Transport. - */ - - io.util.inherit(XHR, io.Transport); - - /** - * Establish a connection - * - * @returns {Transport} - * @api public - */ - - XHR.prototype.open = function () { - this.socket.setBuffer(false); - this.onOpen(); - this.get(); - - // we need to make sure the request succeeds since we have no indication - // whether the request opened or not until it succeeded. - this.setCloseTimeout(); - - return this; - }; - - /** - * Check if we need to send data to the Socket.IO server, if we have data in our - * buffer we encode it and forward it to the `post` method. - * - * @api private - */ - - XHR.prototype.payload = function (payload) { - var msgs = []; - - for (var i = 0, l = payload.length; i < l; i++) { - msgs.push(io.parser.encodePacket(payload[i])); - } - - this.send(io.parser.encodePayload(msgs)); - }; - - /** - * Send data to the Socket.IO server. - * - * @param data The message - * @returns {Transport} - * @api public - */ - - XHR.prototype.send = function (data) { - this.post(data); - return this; - }; - - /** - * Posts a encoded message to the Socket.IO server. - * - * @param {String} data A encoded message. - * @api private - */ - - function empty () { }; - - XHR.prototype.post = function (data) { - var self = this; - this.socket.setBuffer(true); - - function stateChange () { - if (this.readyState == 4) { - this.onreadystatechange = empty; - self.posting = false; - - if (this.status == 200){ - self.socket.setBuffer(false); - } else { - self.onClose(); - } - } - } - - function onload () { - this.onload = empty; - self.socket.setBuffer(false); - }; - - this.sendXHR = this.request('POST'); - - if (global.XDomainRequest && this.sendXHR instanceof XDomainRequest) { - this.sendXHR.onload = this.sendXHR.onerror = onload; - } else { - this.sendXHR.onreadystatechange = stateChange; - } - - this.sendXHR.send(data); - }; - - /** - * Disconnects the established `XHR` connection. - * - * @returns {Transport} - * @api public - */ - - XHR.prototype.close = function () { - this.onClose(); - return this; - }; - - /** - * Generates a configured XHR request - * - * @param {String} url The url that needs to be requested. - * @param {String} method The method the request should use. - * @returns {XMLHttpRequest} - * @api private - */ - - XHR.prototype.request = function (method) { - var req = io.util.request(this.socket.isXDomain()) - , query = io.util.query(this.socket.options.query, 't=' + +new Date); - - req.open(method || 'GET', this.prepareUrl() + query, true); - - if (method == 'POST') { - try { - if (req.setRequestHeader) { - req.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); - } else { - // XDomainRequest - req.contentType = 'text/plain'; - } - } catch (e) {} - } - - return req; - }; - - /** - * Returns the scheme to use for the transport URLs. - * - * @api private - */ - - XHR.prototype.scheme = function () { - return this.socket.options.secure ? 'https' : 'http'; - }; - - /** - * Check if the XHR transports are supported - * - * @param {Boolean} xdomain Check if we support cross domain requests. - * @returns {Boolean} - * @api public - */ - - XHR.check = function (socket, xdomain) { - try { - var request = io.util.request(xdomain), - usesXDomReq = (global.XDomainRequest && request instanceof XDomainRequest), - socketProtocol = (socket && socket.options && socket.options.secure ? 'https:' : 'http:'), - isXProtocol = (global.location && socketProtocol != global.location.protocol); - if (request && !(usesXDomReq && isXProtocol)) { - return true; - } - } catch(e) {} - - return false; - }; - - /** - * Check if the XHR transport supports cross domain requests. - * - * @returns {Boolean} - * @api public - */ - - XHR.xdomainCheck = function (socket) { - return XHR.check(socket, true); - }; - -})( - 'undefined' != typeof io ? io.Transport : module.exports - , 'undefined' != typeof io ? io : module.parent.exports - , this -); -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io) { - - /** - * Expose constructor. - */ - - exports.htmlfile = HTMLFile; - - /** - * The HTMLFile transport creates a `forever iframe` based transport - * for Internet Explorer. Regular forever iframe implementations will - * continuously trigger the browsers buzy indicators. If the forever iframe - * is created inside a `htmlfile` these indicators will not be trigged. - * - * @constructor - * @extends {io.Transport.XHR} - * @api public - */ - - function HTMLFile (socket) { - io.Transport.XHR.apply(this, arguments); - }; - - /** - * Inherits from XHR transport. - */ - - io.util.inherit(HTMLFile, io.Transport.XHR); - - /** - * Transport name - * - * @api public - */ - - HTMLFile.prototype.name = 'htmlfile'; - - /** - * Creates a new Ac...eX `htmlfile` with a forever loading iframe - * that can be used to listen to messages. Inside the generated - * `htmlfile` a reference will be made to the HTMLFile transport. - * - * @api private - */ - - HTMLFile.prototype.get = function () { - this.doc = new window[(['Active'].concat('Object').join('X'))]('htmlfile'); - this.doc.open(); - this.doc.write(''); - this.doc.close(); - this.doc.parentWindow.s = this; - - var iframeC = this.doc.createElement('div'); - iframeC.className = 'socketio'; - - this.doc.body.appendChild(iframeC); - this.iframe = this.doc.createElement('iframe'); - - iframeC.appendChild(this.iframe); - - var self = this - , query = io.util.query(this.socket.options.query, 't='+ +new Date); - - this.iframe.src = this.prepareUrl() + query; - - io.util.on(window, 'unload', function () { - self.destroy(); - }); - }; - - /** - * The Socket.IO server will write script tags inside the forever - * iframe, this function will be used as callback for the incoming - * information. - * - * @param {String} data The message - * @param {document} doc Reference to the context - * @api private - */ - - HTMLFile.prototype._ = function (data, doc) { - this.onData(data); - try { - var script = doc.getElementsByTagName('script')[0]; - script.parentNode.removeChild(script); - } catch (e) { } - }; - - /** - * Destroy the established connection, iframe and `htmlfile`. - * And calls the `CollectGarbage` function of Internet Explorer - * to release the memory. - * - * @api private - */ - - HTMLFile.prototype.destroy = function () { - if (this.iframe){ - try { - this.iframe.src = 'about:blank'; - } catch(e){} - - this.doc = null; - this.iframe.parentNode.removeChild(this.iframe); - this.iframe = null; - - CollectGarbage(); - } - }; - - /** - * Disconnects the established connection. - * - * @returns {Transport} Chaining. - * @api public - */ - - HTMLFile.prototype.close = function () { - this.destroy(); - return io.Transport.XHR.prototype.close.call(this); - }; - - /** - * Checks if the browser supports this transport. The browser - * must have an `Ac...eXObject` implementation. - * - * @return {Boolean} - * @api public - */ - - HTMLFile.check = function (socket) { - if (typeof window != "undefined" && (['Active'].concat('Object').join('X')) in window){ - try { - var a = new window[(['Active'].concat('Object').join('X'))]('htmlfile'); - return a && io.Transport.XHR.check(socket); - } catch(e){} - } - return false; - }; - - /** - * Check if cross domain requests are supported. - * - * @returns {Boolean} - * @api public - */ - - HTMLFile.xdomainCheck = function () { - // we can probably do handling for sub-domains, we should - // test that it's cross domain but a subdomain here - return false; - }; - - /** - * Add the transport to your public io.transports array. - * - * @api private - */ - - io.transports.push('htmlfile'); - -})( - 'undefined' != typeof io ? io.Transport : module.exports - , 'undefined' != typeof io ? io : module.parent.exports -); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io, global) { - - /** - * Expose constructor. - */ - - exports['xhr-polling'] = XHRPolling; - - /** - * The XHR-polling transport uses long polling XHR requests to create a - * "persistent" connection with the server. - * - * @constructor - * @api public - */ - - function XHRPolling () { - io.Transport.XHR.apply(this, arguments); - }; - - /** - * Inherits from XHR transport. - */ - - io.util.inherit(XHRPolling, io.Transport.XHR); - - /** - * Merge the properties from XHR transport - */ - - io.util.merge(XHRPolling, io.Transport.XHR); - - /** - * Transport name - * - * @api public - */ - - XHRPolling.prototype.name = 'xhr-polling'; - - /** - * Indicates whether heartbeats is enabled for this transport - * - * @api private - */ - - XHRPolling.prototype.heartbeats = function () { - return false; - }; - - /** - * Establish a connection, for iPhone and Android this will be done once the page - * is loaded. - * - * @returns {Transport} Chaining. - * @api public - */ - - XHRPolling.prototype.open = function () { - var self = this; - - io.Transport.XHR.prototype.open.call(self); - return false; - }; - - /** - * Starts a XHR request to wait for incoming messages. - * - * @api private - */ - - function empty () {}; - - XHRPolling.prototype.get = function () { - if (!this.isOpen) return; - - var self = this; - - function stateChange () { - if (this.readyState == 4) { - this.onreadystatechange = empty; - - if (this.status == 200) { - self.onData(this.responseText); - self.get(); - } else { - self.onClose(); - } - } - }; - - function onload () { - this.onload = empty; - this.onerror = empty; - self.retryCounter = 1; - self.onData(this.responseText); - self.get(); - }; - - function onerror () { - self.retryCounter ++; - if(!self.retryCounter || self.retryCounter > 3) { - self.onClose(); - } else { - self.get(); - } - }; - - this.xhr = this.request(); - - if (global.XDomainRequest && this.xhr instanceof XDomainRequest) { - this.xhr.onload = onload; - this.xhr.onerror = onerror; - } else { - this.xhr.onreadystatechange = stateChange; - } - - this.xhr.send(null); - }; - - /** - * Handle the unclean close behavior. - * - * @api private - */ - - XHRPolling.prototype.onClose = function () { - io.Transport.XHR.prototype.onClose.call(this); - - if (this.xhr) { - this.xhr.onreadystatechange = this.xhr.onload = this.xhr.onerror = empty; - try { - this.xhr.abort(); - } catch(e){} - this.xhr = null; - } - }; - - /** - * Webkit based browsers show a infinit spinner when you start a XHR request - * before the browsers onload event is called so we need to defer opening of - * the transport until the onload event is called. Wrapping the cb in our - * defer method solve this. - * - * @param {Socket} socket The socket instance that needs a transport - * @param {Function} fn The callback - * @api private - */ - - XHRPolling.prototype.ready = function (socket, fn) { - var self = this; - - io.util.defer(function () { - fn.call(self); - }); - }; - - /** - * Add the transport to your public io.transports array. - * - * @api private - */ - - io.transports.push('xhr-polling'); - -})( - 'undefined' != typeof io ? io.Transport : module.exports - , 'undefined' != typeof io ? io : module.parent.exports - , this -); - -/** - * socket.io - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (exports, io, global) { - /** - * There is a way to hide the loading indicator in Firefox. If you create and - * remove a iframe it will stop showing the current loading indicator. - * Unfortunately we can't feature detect that and UA sniffing is evil. - * - * @api private - */ - - var indicator = global.document && "MozAppearance" in - global.document.documentElement.style; - - /** - * Expose constructor. - */ - - exports['jsonp-polling'] = JSONPPolling; - - /** - * The JSONP transport creates an persistent connection by dynamically - * inserting a script tag in the page. This script tag will receive the - * information of the Socket.IO server. When new information is received - * it creates a new script tag for the new data stream. - * - * @constructor - * @extends {io.Transport.xhr-polling} - * @api public - */ - - function JSONPPolling (socket) { - io.Transport['xhr-polling'].apply(this, arguments); - - this.index = io.j.length; - - var self = this; - - io.j.push(function (msg) { - self._(msg); - }); - }; - - /** - * Inherits from XHR polling transport. - */ - - io.util.inherit(JSONPPolling, io.Transport['xhr-polling']); - - /** - * Transport name - * - * @api public - */ - - JSONPPolling.prototype.name = 'jsonp-polling'; - - /** - * Posts a encoded message to the Socket.IO server using an iframe. - * The iframe is used because script tags can create POST based requests. - * The iframe is positioned outside of the view so the user does not - * notice it's existence. - * - * @param {String} data A encoded message. - * @api private - */ - - JSONPPolling.prototype.post = function (data) { - var self = this - , query = io.util.query( - this.socket.options.query - , 't='+ (+new Date) + '&i=' + this.index - ); - - if (!this.form) { - var form = document.createElement('form') - , area = document.createElement('textarea') - , id = this.iframeId = 'socketio_iframe_' + this.index - , iframe; - - form.className = 'socketio'; - form.style.position = 'absolute'; - form.style.top = '0px'; - form.style.left = '0px'; - form.style.display = 'none'; - form.target = id; - form.method = 'POST'; - form.setAttribute('accept-charset', 'utf-8'); - area.name = 'd'; - form.appendChild(area); - document.body.appendChild(form); - - this.form = form; - this.area = area; - } - - this.form.action = this.prepareUrl() + query; - - function complete () { - initIframe(); - self.socket.setBuffer(false); - }; - - function initIframe () { - if (self.iframe) { - self.form.removeChild(self.iframe); - } - - try { - // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) - iframe = document.createElement(''; -html += '
          '; -html += '
          '; -html += '
          Upload File
          '; -html += '
          Want to upload multiple files at once? Please upgrade to the latest Flash Player, then reload this page. For some reason our Flash based uploader did not load, so you are currently using our single file uploader.
          '; -html += spacer(1,20) + '
          '; -var url = zero_client.targetURL; -if (url.indexOf('?') > -1) url += '&'; else url += '?'; -url += 'format=jshtml&onafter=' + escape('window.parent.upload_basic_finish(response);'); -Debug.trace('upload', "Prepping basic upload: " + url); -html += '
          '; -html += '
          '; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "hide_popup_dialog()") + ' ' + large_icon_button('page_white_get.png', 'Upload', "upload_basic_go()") + '
          '; -html += '
          '; -html += ''; -html += '
          '; -html += ''; -session.hooks.keys[ESC_KEY] = 'hide_popup_dialog'; -show_popup_dialog(528, 200, html); -} -function upload_basic_go() { -$('f_upload_basic').submit(); -$('d_upload_form').hide(); -$('d_upload_progress').show(); -} -function upload_basic_finish(response) { -Debug.trace('upload', "Basic upload complete: " + dumper(response)); -setTimeout( 'upload_basic_finish_2()', 100 ); -} -function upload_basic_finish_2() { -$('i_upload_basic').src = 'blank.html'; -setTimeout( 'upload_basic_finish_3()', 100 ); -} -function upload_basic_finish_3() { -hide_popup_dialog(); -delete session.progress; -show_progress_dialog( 0, 'Finishing Upload...', true ); -fire_callback( session.upload_callback ); -} -function upload_destroy() { -if (zero_client) { -zero_client.destroy(); -delete ZeroUpload.clients[ zero_client.id ]; -zero_client = null; -} -} -function prep_upload(dom_id, url, callback, types) { -session.upload_callback = callback; -if (url) { -if (url.indexOf('?') > -1) url += '&'; else url += '?'; -url += 'session=' + session.cookie.get('effect_session_id'); -} -upload_destroy(); -zero_client = new ZeroUpload.Client(); -if (url) zero_client.setURL( url ); -zero_client.setHandCursor( true ); -if (types) zero_client.setFileTypes( types[0], types[1] ); -zero_client.addEventListener( 'queueStart', uploadQueueStart ); -zero_client.addEventListener( 'fileStart', uploadFileStart ); -zero_client.addEventListener( 'progress', uploadProgress ); -zero_client.addEventListener( 'fileComplete', uploadFileComplete ); -zero_client.addEventListener( 'queueComplete', uploadQueueComplete ); -zero_client.addEventListener( 'error', uploadError ); -zero_client.addEventListener( 'debug', function(client, eventName, args) { -Debug.trace('upload', "Caught event: " + eventName); -} ); -if (dom_id) { -Debug.trace('upload', "Gluing ZeroUpload to: " + dom_id); -zero_client.glue( dom_id ); -} -} -Class.create( 'Debug', { -__static: { -enabled: false, -categories: { all: 1 }, -buffer: [], -max_rows: 5000, -win: null, -ie: !!navigator.userAgent.match(/MSIE/), -ie6: !!navigator.userAgent.match(/MSIE\D+6/), -init: function() { -Debug.enabled = true; -Debug.trace( 'debug', 'Debug log start' ); -var html = '

          '; -if (Debug.ie) { -setTimeout( function() { -document.body.insertAdjacentHTML('beforeEnd', -'
          ' + html + '
          ' -); -}, 1000 ); -} -else { -var div = document.createElement('DIV'); -div.id = 'd_debug'; -div.setAttribute('id', 'd_debug'); -div.style.position = Debug.ie6 ? 'absolute' : 'fixed'; -div.style.zIndex = '101'; -div.style.left = '0px'; -div.style.top = '0px'; -div.style.width = '100%'; -div.innerHTML = html; -document.getElementsByTagName('body')[0].appendChild(div); -} -}, -show: function() { -if (!Debug.win || Debug.win.closed) { -Debug.trace('debug', "Opening debug window"); -Debug.win = window.open( '', 'DebugWindow', 'width=600,height=500,menubar=no,resizable=yes,scrollbars=yes,location=no,status=no,toolbar=no,directories=no' ); -if (!Debug.win) return alert("Failed to open window. Popup blocker maybe?"); -var doc = Debug.win.document; -doc.open(); -doc.writeln( 'Debug Log' ); -doc.writeln( '
          ' ); -doc.writeln( '
          ' ); -doc.writeln( '
          ' ); -doc.writeln( '' ); -doc.writeln( '' ); -doc.writeln( '
          ' ); -doc.writeln( '' ); -doc.close(); -} -Debug.win.focus(); -}, -console_execute: function() { -var cmd = Debug.win.document.getElementById('fe_command'); -if (cmd.value.length) { -Debug.trace( 'console', cmd.value ); -try { -Debug.trace( 'console', '' + eval(cmd.value) ); -} -catch (e) { -Debug.trace( 'error', 'JavaScript Interpreter Exception: ' + e.toString() ); -} -} -}, -get_time_stamp: function(now) { -var date = new Date( now * 1000 ); -var hh = date.getHours(); if (hh < 10) hh = "0" + hh; -var mi = date.getMinutes(); if (mi < 10) mi = "0" + mi; -var ss = date.getSeconds(); if (ss < 10) ss = "0" + ss; -var sss = '' + date.getMilliseconds(); while (sss.length < 3) sss = "0" + sss; -return '' + hh + ':' + mi + ':' + ss + '.' + sss; -}, -refresh_console: function() { -if (!Debug.win || Debug.win.closed) return; -var div = Debug.win.document.getElementById('d_debug_log'); -if (div) { -var row = null; -while ( row = Debug.buffer.shift() ) { -var time_stamp = Debug.get_time_stamp(row.time); -var msg = row.msg; -msg = msg.replace(/\t/g, "    "); -msg = msg.replace(//g, ">"); -msg = msg.replace(/\n/g, "
          \n"); -var html = ''; -var sty = 'float:left; font-family: Consolas, Courier, mono; font-size: 12px; cursor:default; margin-right:10px; margin-bottom:1px; padding:2px;'; -html += '
          ' + time_stamp + '
          '; -html += '
          ' + row.cat + '
          '; -html += '
          ' + msg + '
          '; -html += '
          '; -var chunk = Debug.win.document.createElement('DIV'); -chunk.style['float'] = 'none'; -chunk.innerHTML = html; -div.appendChild(chunk); -} -var cmd = Debug.win.document.getElementById('fe_command'); -cmd.focus(); -} -Debug.dirty = 0; -Debug.win.scrollTo(0, 99999); -}, -hires_time_now: function() { -var now = new Date(); -return ( now.getTime() / 1000 ); -}, -trace: function(cat, msg) { -if (arguments.length == 1) { -msg = cat; -cat = 'debug'; -} -if (Debug.categories.all || Debug.categories[cat]) { -Debug.buffer.push({ cat: cat, msg: msg, time: Debug.hires_time_now() }); -if (Debug.buffer.length > Debug.max_rows) Debug.buffer.shift(); -if (!Debug.dirty) { -Debug.dirty = 1; -setTimeout( 'Debug.refresh_console();', 1 ); -} -} -} -} -} ); -var session = { -inited: false, -api_mod_cache: {}, -query: parseQueryString( ''+location.search ), -cookie: new CookieTree({ path: '/effect/' }), -storage: {}, -storage_dirty: false, -hooks: { -keys: {} -}, -username: '', -em_width: 11, -audioResourceMatch: /\.mp3$/i, -imageResourceMatch: /\.(jpe|jpeg|jpg|png|gif)$/i, -textResourceMatch: /\.xml$/i, -movieResourceMatch: /\.(flv|mp4|mp4v|mov|3gp|3g2)$/i, -imageResourceMatchString: '\.(jpe|jpeg|jpg|png|gif)$' -}; -session.debug = session.query.debug ? true : false; -var page_manager = null; -var preload_icons = []; -var preload_images = [ -'loading.gif', -'aquaprogressbar.gif', -'aquaprogressbar_bkgnd.gif' -]; -function get_base_url() { -return protocol + '://' + location.hostname + session.config.BaseURI; -} -function effect_init() { -if (session.inited) return; -session.inited = true; -assert( window.config, "Config not loaded" ); -session.config = window.config; -Debug.trace("Starting up"); -rendering_page = false; -preload(); -window.$R = {}; -for (var key in config.RegExpShortcuts) { -$R[key] = new RegExp( config.RegExpShortcuts[key] ); -} -ww_precalc_font("body", "effect_precalc_font_finish"); -page_manager = new Effect.PageManager( config.Pages.Page ); -var session_id = session.cookie.get('effect_session_id'); -if (session_id && session_id.match(/^login/)) { -do_session_recover(); -} -else { -show_default_login_status(); -Nav.init(); -} -Blog.search({ -stag: 'sidebar_docs', -limit: 20, -title_only: true, -sort_by: 'seq', -sort_dir: -1, -target: 'd_sidebar_documents', -outer_div_class: 'sidebar_blog_row', -title_class: 'sidebar_blog_title', -after: '' -}); -Blog.search({ -stag: 'sidebar_tutorials', -limit: 5, -title_only: true, -sort_by: 'seq', -sort_dir: -1, -target: 'd_sidebar_tutorials', -outer_div_class: 'sidebar_blog_row', -title_class: 'sidebar_blog_title', -after: '' -}); -Blog.search({ -stag: 'sidebar_plugins', -limit: 5, -title_only: true, -sort_by: 'seq', -sort_dir: -1, -target: 'd_sidebar_plugins', -outer_div_class: 'sidebar_blog_row', -title_class: 'sidebar_blog_title', -after: '' -}); -$('fe_search_bar').onkeydown = delay_onChange_input_text; -user_storage_idle(); -} -function effect_precalc_font_finish(width, height) { -session.em_width = width; -} -function preload() { -for (var idx = 0, len = preload_icons.length; idx < len; idx++) { -var url = images_uri + '/icons/' + preload_icons[idx] + '.gif'; -preload_icons[idx] = new Image(); -preload_icons[idx].src = url; -} -for (var idx = 0, len = preload_images.length; idx < len; idx++) { -var url = images_uri + '/' + preload_images[idx]; -preload_images[idx] = new Image(); -preload_images[idx].src = url; -} -} -function $P(id) { -if (!id) id = page_manager.current_page_id; -var page = page_manager.find(id); -assert( !!page, "Failed to locate page: " + id ); -return page; -} -function get_pref(name) { -if (!session.user || !session.user.Preferences) return alert("ASSERT FAILURE! Tried to lookup pref " + name + " and user is not yet loaded!"); -return session.user.Preferences[name]; -} -function get_bool_pref(name) { -return (get_pref(name) == 1); -} -function set_pref(name, value) { -session.user.Preferences[name] = value; -} -function set_bool_pref(name, value) { -set_pref(name, value ? '1' : '0'); -} -function save_prefs() { -var prefs_to_save = {}; -if (arguments.length) { -for (var idx = 0, len = arguments.length; idx < len; idx++) { -var key = arguments[idx]; -prefs_to_save[key] = get_pref(key); -} -} -else prefs_to_save = session.user.Preferences; -effect_api_mod_touch('user_get'); -effect_api_send('user_update', { -Username: session.username, -Preferences: prefs_to_save -}, 'save_prefs_2'); -} -function save_prefs_2(response) { -do_message('success', 'Preferences saved.'); -} - -function get_full_name(username) { -var user = session.users[username]; -if (!user) return username; -return user.FullName; -} -function get_buddy_icon_url(username, size) { -var mod = session.api_mod_cache.get_buddy_icon || 0; -if (!size) size = 32; -var url = '/effect/api/get_buddy_icon?username='+username + '&mod=' + mod + '&size=' + size; -return url; -} -function get_buddy_icon_display(username, show_icon, show_name) { -if ((typeof(show_icon) == 'undefined') && get_bool_pref('show_user_icons')) show_icon = 1; -if ((typeof(show_name) == 'undefined') && get_bool_pref('show_user_names')) show_name = 1; -var html = ''; -if (show_icon) html += ''; -if (show_icon && show_name) html += '
          '; -if (show_name) html += username; -return html; -} -function do_session_recover() { -session.hooks.after_error = 'do_logout'; -effect_api_send('session_recover', {}, 'do_login_2', { _from_recover: 1 } ); -} -function require_login() { -if (session.user) return true; -Debug.trace('Page requires login, showing login page'); -session.nav_after_login = Nav.currentAnchor(); -setTimeout( function() { -Nav.go( 'Login' ); -}, 1 ); -return false; -} -function popup_window(url, name) { -if (!url) url = ''; -if (!name) name = ''; -var win = window.open(url, name); -if (!win) return alert('Failed to open popup window. If you have a popup blocker, please disable it for this website and try again.'); -return win; -} -function do_login_prompt() { -hide_popup_dialog(); -delete session.progress; -if (!session.temp_password) session.temp_password = ''; -if (!session.username) session.username = ''; -var temp_username = session.open_id || session.username || ''; -var html = ''; -html += '
          '; -html += '
          '; -html += '
          Effect Developer Login
          '; -html += '
          '; -html += '
          Effect Username  or  '+icon('openid', 'OpenID', 'popup_window(\'http://openid.net/\')', 'What is OpenID?')+'


          '; -html += '
          '; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "clear_login()") + ' ' + large_icon_button('check', 'Login', 'do_login()') + '
          '; -html += '
          '; -html += ''; -session.hooks.keys[ENTER_KEY] = 'do_login'; -session.hooks.keys[ESC_KEY] = 'clear_login'; -safe_focus( 'fe_username' ); -show_popup_dialog(450, 225, html); -} -function do_openid_reg(title, auto_login_button) { -hide_popup_dialog(); -delete session.progress; -if (!title) title = 'Register Account Using OpenID'; -if (typeof(auto_login_button) == 'undefined') auto_login_button = 1; -var html = ''; -html += '
          '; -html += '
          '; -html += '
          '+title+'
          '; -html += '
          '; -html += '
          '+icon('openid', 'Enter Your OpenID URL:')+'
          '; -if (auto_login_button) html += '


          '; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "hide_popup_dialog()") + ' ' + large_icon_button('check', title.match(/login/i) ? 'Login' : 'Register', 'do_openid_login()') + '
          '; -html += '
          '; -html += ''; -session.hooks.keys[ENTER_KEY] = 'do_openid_login'; -session.hooks.keys[ESC_KEY] = 'hide_popup_dialog'; -safe_focus( 'fe_username' ); -show_popup_dialog(450, 225, html); -} -function do_login_prompt_2() { -hide_popup_dialog(); -delete session.progress; -if (!session.temp_password) session.temp_password = ''; -if (!session.username) session.username = ''; -var html = ''; -html += '
          '; -html += '
          '; -html += '
          Enter Your Password
          '; -html += '
          '; -html += '
          Password:


          '; -html += '
          '; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "clear_login()") + ' ' + large_icon_button('check', 'Login', 'do_effect_login()') + '
          '; -html += '
          '; -html += ''; -session.hooks.keys[ENTER_KEY] = 'do_effect_login'; -session.hooks.keys[ESC_KEY] = 'clear_login'; -safe_focus( 'fe_lp_password' ); -show_popup_dialog(450, 225, html); -} -function clear_login() { -hide_popup_dialog(); -Nav.prev(); -} -function do_login() { -if ($('fe_username').value.match(/^\w+$/)) { -session.username = $('fe_username').value; -session.auto_login = $('fe_auto_login').checked; -do_login_prompt_2(); -return; -} -else { -do_openid_login(); -} -} -function do_openid_login() { -if (!$('fe_username').value) return; -session.openid_win = popup_window(''); -if (!session.openid_win) return; -session.open_id = $('fe_username').value; -session.auto_login = $('fe_auto_login') && $('fe_auto_login').checked; -hide_popup_dialog(); -show_progress_dialog(1, "Logging in..."); -session.hooks.before_error = 'close_openid_window'; -session.hooks.after_error = 'do_login_prompt'; -effect_api_send('openid_login', { -OpenID: session.open_id, -Infinite: session.auto_login ? 1 : 0 -}, 'do_openid_login_2'); -} -function close_openid_window() { -if (session.openid_win) { -session.openid_win.close(); -delete session.openid_win; -} -} -function do_openid_login_2(response) { -if (response.CheckURL) { -Debug.trace('openid', "Redirecting popup window to OpenID Check URL: " + response.CheckURL); -show_progress_dialog(1, "Waiting for popup window...", false, ['x', 'Cancel', 'do_login_prompt()']); -session.openid_win.location = response.CheckURL; -session.openid_win.focus(); -} -} -function receive_openid_response(iframe_response) { -var response = deep_copy_object(iframe_response); -Debug.trace('openid', "Received OpenID Response: " + dumper(response)); -hide_popup_dialog(); -if (response.Code) { -close_openid_window(); -return do_error( response.Description ); -} -delete session.hooks.before_error; -delete session.hooks.after_error; -if (response.SessionID) { -session.cookie.set( 'effect_session_id', response.SessionID ); -session.cookie.save(); -} -switch (response.Action) { -case 'popup': -show_progress_dialog(1, "Waiting for popup window...", false, ['x', 'Cancel', 'do_login_prompt()']); -Debug.trace('openid', "Redirecting popup window to OpenID Setup URL: " + response.SetupURL); -session.openid_win.location = response.SetupURL; -session.openid_win.focus(); -break; -case 'login': -close_openid_window(); -do_login_2(response); -break; -case 'register': -if (!response.Info) response.Info = {}; -close_openid_window(); -Debug.trace('openid', 'Original OpenID: ' + response.OpenID_Login); -Debug.trace('openid', 'Clean OpenID: ' + response.OpenID_Unique); -Debug.trace('openid', 'Registration Info: ' + dumper(response.Info)); -session.prereg = response.Info; -session.prereg.open_id_login = response.OpenID_Login; -session.prereg.open_id = response.OpenID_Unique; -if (session.user) { -if (!session.user.OpenIDs) session.user.OpenIDs = {}; -if (!session.user.OpenIDs.OpenID) session.user.OpenIDs.OpenID = []; -var dupe = find_object( session.user.OpenIDs.OpenID, { Unique: session.prereg.open_id } ); -if (dupe) return do_error("That OpenID is already registered and attached to your account. No need to add it again."); -session.user.OpenIDs.OpenID.push({ -Login: session.prereg.open_id_login, -Unique: session.prereg.open_id -}); -setTimeout( function() { -Nav.go('MyAccount', true); -do_message('success', 'Added new OpenID URL to account.'); -}, 1 ); -} -else { -setTimeout( function() { Nav.go('CreateAccount', true); }, 1 ); -} -break; -} -} -function do_effect_login() { -var password = $('fe_lp_password').value; -session.auto_login = $('fe_auto_login').checked; -hide_popup_dialog(); -show_progress_dialog(1, "Logging in..."); -session.hooks.after_error = 'do_login_prompt'; -effect_api_send('user_login', { -Username: session.username, -Password: password, -Infinite: session.auto_login ? 1 : 0 -}, 'do_login_2'); -} -function do_logout() { -effect_api_send('user_logout', {}, 'do_logout_2'); -} -function do_logout_2(response) { -hide_popup_dialog(); -show_default_login_status(); -delete session.hooks.after_error; -delete session.cookie.tree.effect_session_id; -session.cookie.save(); -session.storage = {}; -session.storage_dirty = false; -delete session.user; -delete session.first_login; -var old_username = session.username; -session.username = ''; -if (Nav.inited) { -Nav.go('Main'); -if (old_username) $GR.growl('success', "Logged out of account: " + old_username); -} -else { -Nav.init(); -} -} -function do_login_2(response, tx) { -if (response.FirstLogin) session.first_login = 1; -if (response.User.UserStorage) { -Debug.trace('Recovering site storage blob: session.storage = ' + response.User.UserStorage + ';'); -try { -eval( 'session.storage = ' + response.User.UserStorage + ';' ); -} -catch (e) { -Debug.trace("SITE STORAGE RECOVERY FAILED: " + e); -session.storage = {}; -} -delete response.User.UserStorage; -session.storage_dirty = false; -} -session.user = response.User; -session.username = session.user.Username; -hide_popup_dialog(); -delete session.hooks.after_error; -update_header(); -if (!tx || !tx._from_recover) $GR.growl('success', "Logged in as: " + session.username); -if (session.nav_after_login) { -Nav.go( session.nav_after_login ); -delete session.nav_after_login; -} -else if (Nav.currentAnchor().match(/^Login/)) { -Nav.go('Home'); -} -else { -Nav.refresh(); -} -Nav.init(); -} -function user_storage_mark() { -Debug.trace("Marking user storage as dirty"); -session.storage_dirty = true; -} -function user_storage_idle() { -if (session.storage_dirty && !session.mouseIsDown) { -user_storage_save(); -session.storage_dirty = false; -} -setTimeout( 'user_storage_idle()', 5000 ); -} -function user_storage_save() { -if (session.user) { -Debug.trace("Committing user storage blob"); -effect_api_send('update_user_storage', { Data: serialize(session.storage) }, 'user_storage_save_finish', { _silent: 1 } ); -} -} -function user_storage_save_finish(response, tx) { -} -function show_default_login_status() { -$('d_sidebar_wrapper_recent_games').hide(); -$('d_login_status').innerHTML = '
          ' + -'
          ' + -large_icon_button('key', "Login", '#Home') + '' + spacer(1,1) + '' + -'' + large_icon_button('user_add.png', "Signup", '#CreateAccount') + '
          ' + -'
          '; -$('d_tagline').innerHTML = -'Login' + ' | ' + -'Create Account'; -} -function update_header() { -var html = ''; -html += '
          '; -html += ''; -html += ''; -html += ''; -html += ''+spacer(2,2)+''; -html += session.user.FullName + '
          '; -html += spacer(1,5) + '
          '; -html += 'My Home  |  '; -html += 'Logout'; -html += '
          '; -$('d_login_status').innerHTML = html; -$('d_tagline').innerHTML = -'Welcome '+session.user.FirstName+'' + ' | ' + -'My Home' + ' | ' + -'Logout'; -effect_api_get( 'get_user_games', { limit:5, offset:0 }, 'receive_sidebar_recent_games', { } ); -} -function receive_sidebar_recent_games(response, tx) { -var html = ''; -if (response.Rows && response.Rows.Row) { -var games = always_array( response.Rows.Row ); -for (var idx = 0, len = games.length; idx < len; idx++) { -var game = games[idx]; -html += ''; -} -html += ''; -$('d_sidebar_recent_games').innerHTML = html; -$('d_sidebar_wrapper_recent_games').show(); -} -else { -$('d_sidebar_wrapper_recent_games').hide(); -} -} -function check_privilege(key) { -if (!session.user) return false; -if (session.user.Privileges.admin == 1) return true; -if (!key.toString().match(/^\//)) key = '/' + key; -var value = lookup_path(key, session.user.Privileges); -return( value && (value != 0) ); -} -function is_admin() { -return check_privilege('admin'); -} -function upgrade_flash_error() { -return alert("Sorry, file upload requires Adobe Flash Player 9 or higher."); -} -function cancel_user_image_manager() { -upload_destroy(); -hide_popup_dialog(); -delete session.hooks.keys[DELETE_KEY]; -} -function do_user_image_manager(callback) { -if (callback) session.uim_callback = callback; -else session.uim_callback = null; -session.temp_last_user_img = null; -session.temp_last_user_image_filename = ''; -var html = '
          '; -html += '
          Image Manager
          '; -html += '
          '; -html += ''; -html += '
          '; -html += '
          '; -html += ''; -html += ''; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', 'cancel_user_image_manager()') + ' ' + large_icon_button('bullet_upload.png', 'Upload Files...', 'upload_basic()', 'b_upload_user_image') + ' ' + large_icon_button('check', 'Choose', 'do_choose_user_image()', 'btn_choose_user_image', '', 'disabled') + '
          '; -html += '
          '; -session.hooks.keys[ENTER_KEY] = 'do_choose_user_image'; -session.hooks.keys[ESC_KEY] = 'cancel_user_image_manager'; -session.hooks.keys[DELETE_KEY] = 'do_delete_selected_user_image'; -show_popup_dialog(500, 300, html); -var self = this; -setTimeout( function() { -prep_upload('b_upload_user_image', '/effect/api/upload_user_image', [self, 'do_upload_user_image_2'], ['Image Files', '*.jpg;*.jpe;*.jpeg;*.gif;*.png']); -}, 1 ); -var args = { -limit: 50, -offset: 0, -random: Math.random() -}; -effect_api_get( 'user_images_get', args, 'uim_populate_images', { } ); -} -function do_upload_user_image_2() { -effect_api_mod_touch('user_images_get'); -effect_api_send('user_get', { -Username: session.username -}, [this, 'do_upload_user_image_3']); -} -function do_upload_user_image_3(response) { -if (response.User.LastUploadError) return do_error( "Failed to upload image: " + response.User.LastUploadError ); -do_user_image_manager( session.uim_callback ); -} -function uim_populate_images(response, tx) { -var html = ''; -var base_url = '/effect/api/view/users/' + session.username + '/images'; -if (response.Rows && response.Rows.Row) { -var imgs = always_array( response.Rows.Row ); -for (var idx = 0, len = imgs.length; idx < len; idx++) { -var img = imgs[idx]; -var class_name = ((img.Filename == session.temp_last_user_image_filename) ? 'choose_item_selected' : 'choose_item'); -html += ''; -} -} -else { -html = ''; -} -$('d_user_image_list').innerHTML = html; -} -function do_select_user_image(img, filename) { -if (session.temp_last_user_img) session.temp_last_user_img.className = 'choose_item'; -img.className = 'choose_item_selected'; -$('btn_choose_user_image').removeClass('disabled'); -session.temp_last_user_img = img; -session.temp_last_user_image_filename = filename; -} -function do_delete_selected_user_image() { -if (session.temp_last_user_image_filename) { -effect_api_send('user_image_delete', { Filename: session.temp_last_user_image_filename }, 'do_delete_selected_user_image_finish', {}); -} -} -function do_delete_selected_user_image_finish(response, tx) { -try { $('d_user_image_list').removeChild( session.temp_last_user_img ); } catch(e) {;} -session.temp_last_user_img = null; -session.temp_last_user_image_filename = null; -} -function do_choose_user_image() { -if (!session.temp_last_user_image_filename) return; -if (session.uim_callback) { -fire_callback( session.uim_callback, session.temp_last_user_image_filename ); -} -cancel_user_image_manager(); -} -function user_image_thumbnail(filename, width, height, attribs) { -var username = session.username; -if (filename.match(/^(\w+)\/(.+)$/)) { -username = RegExp.$1; -filename = RegExp.$2; -} -var url = '/effect/api/view/users/' + username + '/images/' + filename.replace(/\.(\w+)$/, '_thumb.jpg'); -return ''; -} -function get_user_display(username, full_name, base_url) { -if (!base_url) base_url = ''; -return icon('user', full_name || username, base_url + '#User/' + username); -} -function get_game_tab_bar(game_id, cur_page_name) { -return tab_bar([ -['#Game/' + game_id, 'Game', 'controller.png'], -['#GameDisplay/' + game_id, 'Display', 'monitor.png'], -['#GameAssets/' + game_id, 'Assets', 'folder_page_white.png'], -['#GameObjects/' + game_id, 'Objects', 'bricks.png'], -['#GameAudio/' + game_id, 'Audio', 'sound.gif'], -['#GameKeys/' + game_id, 'Keyboard', 'keyboard.png'], -['#GameLevels/' + game_id, 'Levels', 'world.png'], -['#GamePublisher/' + game_id, 'Publish', 'cd.png'] -], cur_page_name); -} -function get_user_tab_bar(cur_page_name) { -var tabs = [ -['#Home', 'My Home', 'house.png'] -]; -tabs.push( ['#MyAccount', 'Edit Account', 'user_edit.png'] ); -tabs.push( ['#ArticleEdit', 'Post Article', 'page_white_edit.png'] ); -if (config.ProEnabled) { -tabs.push( ['#UserPayments', 'Payments', 'money.png'] ); -} -tabs.push( ['#UserLog', 'Security Log', 'application_view_detail.png'] ); -return tab_bar(tabs, cur_page_name); -} -function get_admin_tab_bar(cur_page_name) { -var tabs = []; -tabs.push( ['#Admin', 'Admin', 'lock.png'] ); -tabs.push( ['#TicketSearch/bugs', 'Bug Tracker', 'bug.png'] ); -tabs.push( ['#TicketSearch/helpdesk', 'Help Desk', 'telephone.png'] ); -tabs.push( ['#AdminReport', 'Reports', 'chart_pie.png'] ); -return tab_bar(tabs, cur_page_name); -} -function get_string(path, args) { -assert(window.config, "get_string() called before config loaded"); -if (!args) args = {}; -args.config = config; -args.session = session; -args.query = session.query; -var value = lookup_path(path, config.Strings); -return (typeof(value) == 'string') ? substitute(value, args) : value; -} -function normalize_dir_path(path) { -if (!path.match(/^\//)) path = '/' + path; -if (!path.match(/\/$/)) path += '/'; -return path; -} -function textedit_window_save(storage_key, filename, content, callback) { -if (!callback) callback = null; -effect_api_mod_touch('textedit'); -if (storage_key.match(/^\/games\/([a-z0-9][a-z0-9\-]*[a-z0-9])\/assets(.+)$/)) { -var game_id = RegExp.$1; -var path = RegExp.$2; -show_progress_dialog(1, "Saving file..."); -effect_api_send('asset_save_file_contents', { -GameID: game_id, -Path: path, -Filename: filename, -Content: content -}, 'textedit_window_save_finish', { _mode: 'asset', _game_id: game_id, _filename: filename, _callback: callback } ); -} -else { -show_progress_dialog(1, "Saving data..."); -effect_api_send('admin_save_file_contents', { -Path: storage_key, -Filename: filename, -Content: content -}, 'textedit_window_save_finish', { _mode: 'admin', _storage_key: storage_key, _filename: filename, _callback: callback } ); -} -} -function textedit_window_save_finish(response, tx) { -hide_progress_dialog(); -if (tx._mode == 'asset') { -do_message('success', "Saved asset: \""+tx._filename+"\""); -show_glog_widget(); -} -else { -do_message('success', "Saved data: \""+tx._storage_key+'/'+tx._filename+"\""); -} -if (tx._callback) tx._callback(); -} -function do_buy(args) { -$P().hide(); -$('d_page_loading').show(); -effect_api_send('create_order', args, 'do_buy_redirect', { _buy_args: args } ); -} -function do_buy_redirect(response, tx) { -var args = tx._buy_args; -$('fe_gco_title').value = args.Title || ''; -$('fe_gco_desc').value = args.Desc || ''; -$('fe_gco_price').value = args.Price || ''; -$('fe_gco_after').value = args.After || ''; -$('fe_gco_unique_id').value = response.OrderID; -Debug.trace('payment', "Redirecting to Google Checkout"); -setTimeout( function() { $('BB_BuyButtonForm').submit(); }, 1 ); -} -function show_glog_widget(game_id) { -if (!game_id) game_id = session.glog_game_id; -if (!game_id) { -$('glog_widget').hide(); -return; -} -if (game_id != session.glog_game_id) { -$('glog_widget').hide(); -session.glog_game_id = game_id; -update_glog_widget(game_id); -} -else { -$('glog_widget').show(); -setTimeout( function() { update_glog_widget(game_id); }, 500 ); -} -} -function update_glog_widget(game_id) { -effect_api_get('game_get_log', { -id: game_id, -offset: 0, -limit: 1, -rand: Math.random() -}, 'receive_glog_data', { _game_id: game_id }); -} -function receive_glog_data(response, tx) { -var game_id = tx._game_id; -if (response && response.Rows && response.Rows.Row) { -var rows = always_array( response.Rows.Row ); -var row = rows[0]; -var html = ''; -html += '
          '; -html += '
          Latest Game Activity
          '; -html += ''; -html += ''; -html += '
          '; -html += '
          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + get_buddy_icon_display(row.Username, 1, 0) + ''; -html += '
          ' + icon( get_icon_for_glog_type(row.Type), ''+row.Message+'' ) + '
          '; -html += '
          ' + get_relative_date(row.Date, true) + '
          '; -html += '
          '; -$('glog_widget').innerHTML = html; -$('glog_widget').show(); -} -} -function show_glog_post_dialog(game_id) { -hide_popup_dialog(); -delete session.progress; -var html = ''; -html += '
          '; -html += '
          '; -html += '
          Post Game Log Message
          '; -html += '
          '; -html += ''; -html += '
          Enter your log message here. Plain text only please.
          '; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "hide_popup_dialog()") + ' ' + large_icon_button('check', 'Post Message', "glog_post('"+game_id+"')") + '
          '; -html += '
          '; -html += ''; -session.hooks.keys[ESC_KEY] = 'hide_popup_dialog'; -safe_focus( 'fe_glog_body' ); -show_popup_dialog(500, 175, html); -} -function glog_post(game_id) { -var msg = trim( $('fe_glog_body').value ); -if (msg) { -hide_popup_dialog(); -effect_api_send('game_post_log', { -GameID: game_id, -Message: msg -}, [this, 'glog_post_finish'], { _game_id: game_id }); -} -} -function glog_post_finish(response, tx) { -show_glog_widget( tx._game_id ); -} -function hide_glog_widget() { -$('glog_widget').hide(); -} -function get_icon_for_glog_type(type) { -var icon = 'page_white.png'; -switch (type) { -case 'asset': icon = 'folder_page_white.png'; break; -case 'game': icon = 'controller.png'; break; -case 'member': icon = 'user'; break; -case 'comment': icon = 'comment.png'; break; -case 'level': icon = 'world.png'; break; -case 'sprite': icon = 'cog.png'; break; -case 'tile': icon = 'brick.png'; break; -case 'tileset': icon = 'color_swatch.png'; break; -case 'rev': icon = 'cd.png'; break; -case 'revision': icon = 'cd.png'; break; -case 'font': icon = 'style.png'; break; -case 'key': icon = 'keyboard.png'; break; -case 'audio': icon = 'sound'; break; -case 'payment': icon = 'money.png'; break; -case 'env': icon = 'weather.png'; break; -case 'environment': icon = 'weather.png'; break; -} -return icon; -} -function effect_load_script(url) { -Debug.trace('api', 'Loading script: ' + url); -load_script(url); -} -function effect_api_get_ie(cmd, params, userData) { -if (!session.api_state_ie) session.api_state_ie = {}; -var unique_id = get_unique_id(); -session.api_state_ie[unique_id] = userData; -params.format = 'js'; -params.onafter = 'effect_api_response_ie(' + unique_id + ', response);'; -var url = '/effect/api/' + cmd + composeQueryString(params); -Debug.trace('api', "Sending MSIE HTTP GET: " + url); -load_script(url); -} -function effect_api_response_ie(unique_id, tree) { -Debug.trace('api', "Got response from MSIE HTTP GET"); -var tx = session.api_state_ie[unique_id]; -delete session.api_state_ie[unique_id]; -if (tree.Code == 'session') { -do_logout_2(); -return; -} -if (tree.Code == 'access') { -do_notice("Access Denied", tree.Description, 'do_not_pass_go'); -return; -} -if (tree.Code != 0) { -if (tx._on_error) return fire_callback( tx._on_error, tree, tx ); -return do_error( tree.Description ); -} -if (tree.SessionID) { -if (tree.SessionID == '_DELETE_') { -delete session.cookie.tree.effect_session_id; -} -else { -session.cookie.set( 'effect_session_id', tree.SessionID ); -} -session.cookie.save(); -} -if (tx._api_callback) { -fire_callback( tx._api_callback, tree, tx ); -} -} -function effect_api_get(cmd, params, callback, userData) { -if (!userData) userData = {}; -userData._api_callback = callback; -if (!session.api_mod_cache[cmd] && session.username) session.api_mod_cache[cmd] = hires_time_now(); -if (!params.mod && session.api_mod_cache[cmd]) params.mod = session.api_mod_cache[cmd]; -if (ie) return effect_api_get_ie(cmd, params, userData); -var url = '/effect/api/' + cmd + composeQueryString(params); -Debug.trace('api', "Sending HTTP GET: " + url); -ajax.get( url, 'effect_api_response', userData ); -} -function effect_api_send(cmd, xml, callback, userData) { -if (!userData) userData = {}; -userData._api_callback = callback; -var data = compose_xml('EffectRequest', xml); -Debug.trace('api', "Sending API Command: " + cmd + ": " + data); -ajax.send({ -method: 'POST', -url: '/effect/api/' + cmd, -data: data, -headers: { 'Content-Type': 'text/xml' } -}, 'effect_api_response', userData); -} -function effect_api_response(tx) { -Debug.trace('api', "HTTP " + tx.response.code + ": " + tx.response.data); -if (tx.response.code == 999) { -if (tx.request._auto_retry) { -session.net_error = false; -show_progress_dialog(1, "Trying to reestablish connection..."); -session.net_error = true; -setTimeout( function() { ajax.send(tx.request); }, 1000 ); -return; -} -else return do_error( "HTTP ERROR: " + tx.response.code + ": " + tx.response.data + ' (URL: ' + tx.request.url + ')' ); -} -if (session.net_error) { -hide_progress_dialog(); -session.net_error = false; -} -if (tx.response.code != 200) { -if (tx._silent) return; -else return do_error( "HTTP ERROR: " + tx.response.code + ": " + tx.response.data + ' (URL: ' + tx.request.url + ')' ); -} -var tree = null; -if (!tx._raw) { -var parser = new XML({ -preserveAttributes: true, -text: tx.response.data -}); -if (parser.getLastError()) return do_error("XML PARSE ERROR: " + parser.getLastError()); -tree = parser.getTree(); -if (tree.Code == 'session') { -do_logout_2(); -return; -} -if (tree.Code == 'access') { -do_notice("Access Denied", tree.Description, 'do_not_pass_go'); -return; -} -if (tree.Code != 0) { -if (tx._on_error) return fire_callback( tx._on_error, tree, tx ); -return do_error( tree.Description ); -} -if (tree.SessionID) { -if (tree.SessionID == '_DELETE_') { -delete session.cookie.tree.effect_session_id; -} -else { -session.cookie.set( 'effect_session_id', tree.SessionID ); -} -session.cookie.save(); -} -} -if (tx._api_callback) { -fire_callback( tx._api_callback, tree, tx ); -} -} -function effect_api_mod_touch() { -for (var idx = 0, len = arguments.length; idx < len; idx++) { -session.api_mod_cache[ arguments[idx] ] = hires_time_now(); -} -} -function do_not_pass_go() { -Nav.go('Main'); -} -var Nav = { -loc: '', -old_loc: '', -inited: false, -nodes: [], -init: function() { -if (!this.inited) { -this.inited = true; -this.loc = 'init'; -this.monitor(); -} -}, -monitor: function() { -var parts = window.location.href.split(/\#/); -var anchor = parts[1]; -if (!anchor) anchor = 'Main'; -var full_anchor = '' + anchor; -var sub_anchor = ''; -anchor = anchor.replace(/\%7C/, '|'); -if (anchor.match(/\|(\w+)$/)) { -sub_anchor = RegExp.$1.toLowerCase(); -anchor = anchor.replace(/\|(\w+)$/, ''); -} -if ((anchor != this.loc) && !anchor.match(/^_/)) { -Debug.trace('nav', "Caught navigation anchor: " + full_anchor); -var page_name = ''; -var page_args = null; -if (full_anchor.match(/^\w+\?.+/)) { -parts = full_anchor.split(/\?/); -page_name = parts[0]; -page_args = parseQueryString( parts[1] ); -} -else if (full_anchor.match(/^(\w+)\/(.*)$/)) { -page_name = RegExp.$1; -page_args = RegExp.$2; -} -else { -parts = full_anchor.split(/\//); -page_name = parts[0]; -page_args = parts.slice(1); -} -Debug.trace('nav', "Calling page: " + page_name + ": " + serialize(page_args)); -hide_popup_dialog(); -var result = page_manager.click( page_name, page_args ); -if (result) { -if (window.pageTracker && (this.loc != 'init')) { -setTimeout( function() { pageTracker._trackPageview('/effect/' + anchor); }, 1000 ); -} -this.old_loc = this.loc; -if (this.old_loc == 'init') this.old_loc = 'Main'; -this.loc = anchor; -} -else { -this.go( this.loc ); -} -} -else if (sub_anchor != this.sub_anchor) { -Debug.trace('nav', "Caught sub-anchor: " + sub_anchor); -$P().gosub( sub_anchor ); -} -this.sub_anchor = sub_anchor; -setTimeout( 'Nav.monitor()', 100 ); -}, -go: function(anchor, force) { -anchor = anchor.replace(/^\#/, ''); -if (force) this.loc = 'init'; -window.location.href = '#' + anchor; -}, -prev: function() { -this.go( this.old_loc || 'Main' ); -}, -refresh: function() { -this.loc = 'refresh'; -}, -bar: function() { -var nodes = arguments; -var html = ''; -for (var idx = 0, len = nodes.length; idx < len; idx++) { -var node = nodes[idx]; -if (node) this.nodes[idx] = node; -else node = this.nodes[idx]; -if (node != '_ignore_') { -html += ''; -} -} -html += '
          '; -$('d_nav_bar').innerHTML = html; -}, -title: function(name) { -if (name) document.title = name + ' | EffectGames.com'; -else document.title = 'EffectGames.com'; -}, -currentAnchor: function() { -var parts = window.location.href.split(/\#/); -var anchor = parts[1] || ''; -var sub_anchor = ''; -anchor = anchor.replace(/\%7C/, '|'); -if (anchor.match(/\|(\w+)$/)) { -sub_anchor = RegExp.$1.toLowerCase(); -anchor = anchor.replace(/\|(\w+)$/, ''); -} -return anchor; -} -}; -var Blog = { -edit_caption: '
          *Bold*  |Italic|  {monospace}  [http://link]  Formatting Guide...
          ', -search: function(args) { -if (!args.mode) args.mode = 'and'; -if (!args.offset) args.offset = 0; -if (!args.limit) args.limit = 10; -if (!args.format) args.format = 'xml'; -var query_args = copy_object( args ); -delete query_args.callback; -effect_api_get( 'article_search', query_args, [this, 'search_response'], { _search_args: args } ); -}, -get_article_preview: function(row, args) { -var html = ''; -Debug.trace('blog', 'Row: ' + dumper(row)); -html += '
          '; -var ext_article_url = 'http://' + location.hostname + '/effect/article.psp.html' + row.Path + '/' + row.ArticleID; -var article_url = '#Article' + row.Path + '/' + row.ArticleID; -html += ''; -if (!args.title_only) { -html += '
          '; -html += row.Preview; -html += '  ' + (args.link_title || 'Read Full Story...') + ''; -html += '
          '; -html += ''; -html += '
          '; -var elem_class = args.footer_element_class || 'blog_preview_footer_element'; -if ((session.username == row.Username) || is_admin()) { -html += '
          ' + -icon('page_white_edit.png', "Edit", '#ArticleEdit?path=' + row.Path + '&id=' + row.ArticleID) + '
          '; -} -html += '
          ' + get_user_display(row.Username) + '
          '; -html += '
          ' + icon('calendar', get_short_date_time(row.Published)) + '
          '; -html += '
          ' + icon('talk', row.Comments) + '
          '; -if (0 && row.Tags) html += '
          ' + icon('note.png', make_tag_links(row.Tags, 3)) + '
          '; -html += '
          ' + icon('facebook.png', 'Facebook', "window.open('http://www.facebook.com/sharer.php?u="+encodeURIComponent(ext_article_url)+'&t='+encodeURIComponent(row.Title)+"','sharer','toolbar=0,status=0,width=626,height=436')", "Share on Facebook") + '
          '; -html += '
          ' + icon('twitter.png', 'Twitter', "window.open('http://twitter.com/home?status=Reading%20" + encodeURIComponent(row.Title) + "%3A%20" + encodeURIComponent(ext_article_url)+"')", "Share on Twitter") + '
          '; -html += '
          '; -html += '
          '; -html += '
          '; -} -html += '
          '; -return html; -}, -search_response: function(response, tx) { -var args = tx._search_args; -if (args.callback) return fire_callback(args.callback, response, args); -var div = $(args.target); -assert(div, "Could not find target DIV: " + args.target); -var html = ''; -if (response.Rows && response.Rows.Row) { -var rows = always_array( response.Rows.Row ); -for (var idx = 0, len = rows.length; idx < len; idx++) { -var row = rows[idx]; -html += this.get_article_preview( row, args ); -} -if (args.more && (rows.length == args.limit)) { -html += large_icon_button('page_white_put.png', 'More...', "Blog.more(this, "+encode_object(args)+")") + '
          '; -html += spacer(1,15) + '
          '; -} -if (args.after) html += args.after; -} -else if (response.Code != 0) { -html = 'Search Error: ' . response.Code + ': ' + response.Description; -} -else { -html = args.none_found_msg || 'No articles found.'; -} -div.innerHTML = html; -}, -more: function(div, args) { -args.offset += args.limit; -Debug.trace('blog', "More Args: " + dumper(args)); -div.innerHTML = ''; -effect_api_get( 'article_search', args, [this, 'more_response'], { _search_args: args, _div: div } ); -}, -more_response: function(response, tx) { -var args = tx._search_args; -var button = tx._div; -var html = ''; -if (response.Rows && response.Rows.Row) { -var rows = always_array( response.Rows.Row ); -for (var idx = 0, len = rows.length; idx < len; idx++) { -var row = rows[idx]; -html += this.get_article_preview( row, args ); -} -if (args.more && (rows.length == args.limit)) { -html += large_icon_button('page_white_put.png', 'More...', "Blog.more(this, "+encode_object(args)+")") + '
          '; -html += spacer(1,15) + '
          '; -} -} -else if (response.Code != 0) { -html = 'Search Error: ' . response.Code + ': ' + response.Description; -} -else { -html = args.none_found_msg || 'No more articles found.'; -} -var div = document.createElement('div'); -div.innerHTML = html; -button.parentNode.replaceChild( div, button ); -} -}; -function make_tag_links(csv, max, base_url) { -if (!base_url) base_url = ''; -var tags = csv.split(/\,\s*/); -var append = ''; -if (max && (tags.length > max)) { -tags.length = max; -append = '...'; -} -var html = ''; -for (var idx = 0, len = tags.length; idx < len; idx++) { -html += ''+tags[idx]+''; -if (idx < len - 1) html += ', '; -} -html += append; -return html; -} -function get_url_friendly_title(title) { -title = title.toString().replace(/\W+/g, '_'); -if (title.length > 40) title = title.substring(0, 40); -title = title.replace(/^_+/, ''); -title = title.replace(/_+$/, ''); -return title; -} -function get_full_url(url) { -if (url.match(/^\#/)) { -var parts = window.location.href.split(/\#/); -url = parts[0] + url; -} -return url; -} -var Comments = { -comments_per_page: 10, -get: function(page_id) { -var html = ''; -html += '
          '; -html += '
          Comments'; -html += '
          '; -html += '
          '; -html += '
          '; -setTimeout( function() { Comments.search({ page_id: page_id }); }, 1 ); -return html; -}, -search: function(args) { -if (!args.limit) args.limit = this.comments_per_page; -if (!args.offset) args.offset = 0; -assert(args.page_id, "Comments.search: No page_id specified"); -args.format = 'xml'; -this.last_search = args; -effect_api_get( 'comments_get', args, [this, 'search_response'], { _search_args: args } ); -}, -research: function(offset) { -var args = this.last_search; -if (!args) return; -args.offset = offset; -effect_api_get( 'comments_get', args, [this, 'search_response'], { _search_args: args } ); -}, -search_response: function(response, tx) { -this.comments = []; -var args = tx._search_args; -if (args.callback) return fire_callback(args.callback, response, args); -var html = ''; -html += '
          ' + -large_icon_button( 'comment_edit.png', 'Post Comment...', "Comments.add('"+args.page_id+"')" ) + '
          '; -if (args.page_id.match(/^Article\//)) { -html += '
          ' + icon('feed.png', 'RSS', '/effect/api/comment_feed/' + args.page_id + '.rss', 'Comments RSS Feed') + '
          '; -} -if (response.Items && response.Items.Item && response.List && response.List.length) { -html += ''; -html += '
          '; -var items = this.comments = always_array( response.Items.Item ); -for (var idx = 0, len = items.length; idx < len; idx++) { -var item = items[idx]; -var extra_classes = (args.highlight && (args.highlight == item.ID)) ? ' highlight' : ''; -html += '
          '; -html += '
          '; -if (item.Username) html += ''; -html += '' + item.Name.toString().toUpperCase() + ''; -if (item.Username) html += ''; -html += ', ' + get_short_date_time(item.Date) + '
          '; -html += '
          '; -html += this.get_comment_controls( args.page_id, item ); -html += '
          '; -html += '
          '; -html += '
          ' + item.Comment + '
          '; -html += '
          '; -html += ''; -if (item.LastReply && ((item.LastReply >= time_now() - (86400 * 7)) || (session.username && (session.username == item.Username)))) { -setTimeout( "Comments.show_replies('"+args.page_id+"','"+item.ID+"')", 1 ); -} -} -} -else { -} -$( 'd_comments_' + args.page_id ).innerHTML = html; -}, -get_control: function(icon, code, text, status_text) { -if (!icon.match(/\.\w+$/)) icon += '.gif'; -return '' + code_link(code, text, status_text) + ''; -}, -get_comment_controls: function(page_id, comment) { -var html = ''; -var spacer_txt = '  |  '; -if (session.user) { -html += this.get_control('comment', "Comments.reply('"+page_id+"','"+comment.ID+"')", 'Reply') + spacer_txt; -} -if (comment.Replies) { -if (comment._replies_visible) html += this.get_control('magnify_minus', "Comments.hide_replies('"+page_id+"','"+comment.ID+"')", 'Hide Replies'); -else html += this.get_control('magnify_plus', "Comments.show_replies('"+page_id+"','"+comment.ID+"')", 'Show Replies ('+comment.Replies+')'); -if (session.user) html += spacer_txt; -} -if (session.user) { -html += this.get_control( -'star', -"Comments.like('"+page_id+"','"+comment.ID+"')", -'Like' + (comment.Like ? (' ('+comment.Like+')') : ''), -comment.Like ? (comment.Like + ' ' + ((comment.Like == 1) ? 'person likes this' : 'people like this')) : 'I like this comment' -) + spacer_txt; -if (is_admin()) html += this.get_control('trash', "Comments._delete('"+page_id+"','"+comment.ID+"')", 'Delete') + spacer_txt; -html += this.get_control('warning', "Comments.report('"+page_id+"','"+comment.ID+"')", 'Report Abuse'); -} -return html; -}, -reply: function(page_id, comment_id) { -hide_popup_dialog(); -delete session.progress; -var comment = find_object( this.comments, { ID: comment_id } ); -var html = ''; -html += '
          '; -html += '
          '; -html += '
          Reply to Comment by "'+comment.Name+'"
          '; -html += '
          '; -var name = this.get_name(); -html += '

          Posted by: ' + name; -if (!session.user) html += ' → Create Account'; -html += '


          '; -html += ''; -html += Blog.edit_caption; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "hide_popup_dialog()") + ' ' + large_icon_button('check', 'Post Reply', "Comments.post_reply('"+page_id+"','"+comment_id+"')") + '
          '; -html += '
          '; -html += ''; -session.hooks.keys[ESC_KEY] = 'hide_popup_dialog'; -safe_focus( 'fe_comment_body' ); -show_popup_dialog(600, 300, html); -}, -post_reply: function(page_id, comment_id) { -var value = $('fe_comment_body').value; -if (!value) return; -hide_popup_dialog(); -show_progress_dialog(1, "Posting reply..."); -var name = this.get_name(); -effect_api_mod_touch('comment_replies_get'); -effect_api_send('comment_post_reply', { -PageID: page_id, -CommentID: comment_id, -Username: session.username || '', -Name: name, -Comment: value, -PageURL: location.href -}, [this, 'post_reply_finish'], { _page_id: page_id, _comment_id: comment_id } ); -}, -post_reply_finish: function(response, tx) { -hide_popup_dialog(); -var page_id = tx._page_id; -var comment_id = tx._comment_id; -var comment = find_object( this.comments, { ID: comment_id } ); -do_message('success', "Comment reply posted successfully."); -this.show_replies(page_id, comment_id); -if (!comment.Replies) comment.Replies = 1; else comment.Replies++; -$('d_comment_controls_'+comment_id).innerHTML = this.get_comment_controls( page_id, comment ); -}, -show_replies: function(page_id, comment_id) { -var comment = find_object( this.comments, { ID: comment_id } ); -if (!comment._replies_visible) { -$('d_comment_replies_' + comment_id).show().innerHTML = ''; -} -var args = { page_id: page_id, comment_id: comment_id, offset: 0, limit: 100 }; -effect_api_get( 'comment_replies_get', args, [this, 'receive_replies_response'], { _search_args: args } ); -}, -receive_replies_response: function(response, tx) { -var page_id = tx._search_args.page_id; -var comment_id = tx._search_args.comment_id; -var comment = find_object( this.comments, { ID: comment_id } ); -var html = ''; -var replies = always_array( response.Items.Item ); -for (var idx = 0, len = replies.length; idx < len; idx++) { -var reply = replies[idx]; -html += get_chat_balloon( -(reply.Username == session.username) ? 'blue' : 'grey', -reply.Username, -reply.Comment.replace(/^]*?>(.+)<\/div>$/i, '$1') -); -} -$('d_comment_replies_' + comment_id).innerHTML = html; -if (!comment._replies_visible) { -$('d_comment_replies_' + comment_id).hide(); -animate_div_visibility( 'd_comment_replies_' + comment_id, true ); -} -comment._replies_visible = true; -$('d_comment_controls_'+comment_id).innerHTML = this.get_comment_controls( page_id, comment ); -}, -hide_replies: function(page_id, comment_id) { -var comment = find_object( this.comments, { ID: comment_id } ); -if (comment._replies_visible) { -animate_div_visibility( 'd_comment_replies_' + comment_id, false ); -comment._replies_visible = false; -$('d_comment_controls_'+comment_id).innerHTML = this.get_comment_controls( page_id, comment ); -} -}, -like: function(page_id, comment_id) { -effect_api_mod_touch('comments_get'); -effect_api_send('comment_like', { -PageID: page_id, -CommentID: comment_id -}, [this, 'like_finish'], { _page_id: page_id, _comment_id: comment_id, _on_error: [this, 'like_error'] } ); -}, -like_error: function(response, tx) { -if (response.Code == 'comment_already_like') do_message('error', "You already like this comment."); -else do_error( response.Description ); -}, -like_finish: function(resopnse, tx) { -var page_id = tx._page_id; -var comment_id = tx._comment_id; -var comment = find_object( this.comments, { ID: comment_id } ); -do_message('success', "You now like this comment."); -if (!comment.Like) comment.Like = 1; else comment.Like++; -$('d_comment_controls_'+comment_id).innerHTML = this.get_comment_controls( page_id, comment ); -}, -add: function(page_id) { -hide_popup_dialog(); -delete session.progress; -var html = ''; -html += '
          '; -html += '
          '; -html += '
          Post New Comment
          '; -html += '
          '; -var name = this.get_name(); -html += '

          Posted by: ' + name; -if (!session.user) html += ' → Create Account'; -html += '


          '; -html += ''; -html += Blog.edit_caption; -html += '
          '; -html += '

          '; -html += ''; -html += ''; -html += ''; -html += '
          ' + large_icon_button('x', 'Cancel', "hide_popup_dialog()") + ' ' + large_icon_button('check', 'Post Comment', "Comments.post('"+page_id+"')") + '
          '; -html += '
          '; -html += ''; -session.hooks.keys[ESC_KEY] = 'hide_popup_dialog'; -safe_focus( 'fe_comment_body' ); -show_popup_dialog(600, 300, html); -}, -report: function(page_id, comment_id) { -if (confirm('Are you sure you want to report this comment to the site administrators as abusive and/or spam?')) { -effect_api_send('comment_report_abuse', { -PageID: page_id, -CommentID: comment_id -}, [this, 'report_finish'], { _page_id: page_id, _comment_id: comment_id } ); -} -}, -report_finish: function(response, tx) { -do_message('success', 'Your abuse report has been received, and will be evaluated by the site administrators.'); -}, -_delete: function(page_id, comment_id) { -if (confirm('Are you sure you want to permanently delete this comment?')) { -effect_api_mod_touch('comments_get'); -effect_api_send('comment_delete', { -PageID: page_id, -CommentID: comment_id -}, [this, 'delete_finish'], { _page_id: page_id, _comment_id: comment_id } ); -} -}, -delete_finish: function(response, tx) { -do_message('success', 'The comment was deleted successfully.'); -var page_id = tx._page_id; -this.search({ page_id: page_id }); -}, -get_name: function() { -var name = '(Anonymous)'; -if (session.user) { -if (get_bool_pref('public_profile')) name = session.user.FullName; -else name = session.username; -} -return name; -}, -post: function(page_id) { -var value = $('fe_comment_body').value; -if (!value) return; -hide_popup_dialog(); -show_progress_dialog(1, "Posting comment..."); -var name = this.get_name(); -effect_api_mod_touch('comments_get'); -effect_api_send('comment_post', { -PageID: page_id, -Username: session.username || '', -Name: name, -Comment: value -}, [this, 'post_finish'], { _page_id: page_id } ); -}, -post_finish: function(response, tx) { -hide_popup_dialog(); -var comment_id = response.CommentID; -var page_id = tx._page_id; -this.search({ page_id: page_id, highlight: comment_id }); -} -}; -Class.create( 'Menu', { -id: '', -menu: null, -__construct: function(id) { -this.id = id; -}, -load: function() { -if (!this.menu) { -this.menu = $(this.id); -assert( !!this.menu, "Could not locate DOM element: " + this.id ); -} -}, -get_value: function() { -this.load(); -return this.menu.options[this.menu.selectedIndex].value; -}, -set_value: function(value, auto_add) { -value = str_value(value); -this.load(); -for (var idx = 0, len = this.menu.options.length; idx < len; idx++) { -if (this.menu.options[idx].value == value) { -this.menu.selectedIndex = idx; -return true; -} -} -if (auto_add) { -this.menu.options[this.menu.options.length] = new Option(value, value); -this.menu.selectedIndex = this.menu.options.length - 1; -return true; -} -return false; -}, -disable: function() { -this.load(); -this.menu.disabled = true; -this.menu.setAttribute( 'disabled', 'disabled' ); -}, -enable: function() { -this.load(); -this.menu.setAttribute( 'disabled', '' ); -this.menu.disabled = false; -}, -populate: function(items, sel_value) { -this.load(); -this.menu.options.length = 0; -for (var idx = 0, len = items.length; idx < len; idx++) { -var item = items[idx]; -var item_name = ''; -var item_value = ''; -if (isa_hash(item)) { -item_name = item.label; -item_value = item.data; -} -else if (isa_array(item)) { -item_name = item[0]; -item_value = item[1]; -} -else { -item_name = item_value = item; -} -this.menu.options[ this.menu.options.length ] = new Option( item_name, item_value ); -if (item_value == sel_value) this.menu.selectedIndex = idx; -} -} -} ); -Class.subclass( Menu, 'MultiMenu', { -__static: { -toggle_type: function(id) { -var menu = $(id); -assert(menu, "Could not find menu in DOM: " + id); -if (menu.disabled) return; -var obj = MenuManager.find(id); -assert(obj, "Could not find menu in MenuManager: " + id); -var div = $( 'd_inner_' + id ); -var ic = $( 'ic_' + id ); -var is_multiple = (ic.src.indexOf('contract') > -1); -obj.multi = !is_multiple; -var multiple_tag = !is_multiple ? -' multiple="multiple" size=5' : ''; -var items = []; -for (var idx = 0; idx < menu.options.length; idx++) { -var option = menu.options[idx]; -array_push( items, { -value: option.value, -text: option.text, -selected: option.selected -}); -} -var html = ''; -html += ''; -div.innerHTML = html; -ic.src = images_uri + '/menu_' + (is_multiple ? 'expand' : 'contract') + '.gif'; -obj.menu = null; -} -}, -attribs: null, -multi: false, -toggle: true, -__construct: function(id, attribs) { -this.id = id; -if (attribs) this.attribs = attribs; -}, -get_html: function(items, selected_csv, attribs) { -if (!items) items = []; -if (!selected_csv) selected_csv = ''; -if (attribs) this.attribs = attribs; -var selected = csv_to_hash(selected_csv); -this.menu = null; -if (num_keys(selected) > 1) this.multi = true; -var html = '
          '; -html += ''; -html += ''; -html += ''; -if (this.toggle) html += ''; -html += '
          ' + spacer(1,1) + '
          '+spacer(1,2)+'
          '; -html += '
          '; -return html; -}, -get_value: function() { -this.load(); -var value = ''; -for (var idx = 0; idx < this.menu.options.length; idx++) { -var option = this.menu.options[idx]; -if (option.selected && option.value.length) { -if (value.length > 0) value += ','; -value += option.value; -} -} -return value; -}, -set_value: function(value, auto_add) { -value = '' + value; -this.load(); -if (!value) { -value = ''; -for (var idx = 0; idx < this.menu.options.length; idx++) { -var option = this.menu.options[idx]; -option.selected = (option.value == value); -} -return; -} -var selected = csv_to_hash(value); -if ((num_keys(selected) > 1) && !this.multi) { -MultiMenu.toggle_type(this.id); -var self = this; -setTimeout( function() { -self.set_value(value, auto_add); -}, 1 ); -return; -} -for (var idx = 0; idx < this.menu.options.length; idx++) { -var option = this.menu.options[idx]; -option.selected = selected[option.value] ? true : false; -} -}, -populate: function(items, value) { -this.load(); -this.menu.options.length = 0; -if (!value) value = ''; -var selected = csv_to_hash(value); -for (var idx = 0, len = items.length; idx < len; idx++) { -var item = items[idx]; -var item_name = ''; -var item_value = ''; -if (isa_hash(item)) { -item_name = item.label; -item_value = item.data; -} -else if (isa_array(item)) { -item_name = item[0]; -item_value = item[1]; -} -else { -item_name = item_value = item; -} -var opt = new Option( item_name, item_value ); -this.menu.options[ this.menu.options.length ] = opt; -opt.selected = selected[item_value] ? true : false; -} -}, -collapse: function() { -if (this.multi) MultiMenu.toggle_type(this.id); -}, -expand: function() { -if (!this.multi) MultiMenu.toggle_type(this.id); -} -} ); -Class.create( 'MenuManager', { -__static: { -menus: {}, -register: function(menu) { -this.menus[ menu.id ] = menu; -return menu; -}, -find: function(id) { -return this.menus[id]; -} -} -} ); -Class.create( 'GrowlManager', { -lifetime: 10, -marginRight: 0, -marginTop: 0, -__construct: function() { -this.growls = []; -}, -growl: function(type, msg) { -if (find_object(this.growls, { type: type, msg: msg })) return; -var div = $(document.createElement('div')); -div.className = 'growl_message ' + type; -div.setOpacity(0.0); -div.innerHTML = '
          ' + msg + '
          ' + spacer(1,5) + '
          '; -$('d_growl_wrapper').insertBefore( div, $('d_growl_top').nextSibling ); -var growl = { id:get_unique_id(), type: type, msg: msg, opacity:0.0, start:hires_time_now(), div:div }; -this.growls.push(growl); -this.handle_resize(); -this.animate(growl); -var self = this; -div.onclick = function() { -delete_object(self.growls, { id: growl.id }); -$('d_growl_wrapper').removeChild( div ); -}; -}, -animate: function(growl) { -if (growl.deleted) return; -var now = hires_time_now(); -var div = growl.div; -if (now - growl.start <= 0.5) { -div.setOpacity( tweenFrame(0.0, 1.0, (now - growl.start) * 2, 'EaseOut', 'Quadratic') ); -} -else if (now - growl.start <= this.lifetime) { -if (!growl._fully_opaque) { -div.setOpacity( 1.0 ); -growl._fully_opaque = true; -} -} -else if (now - growl.start <= this.lifetime + 1.0) { -div.setOpacity( tweenFrame(1.0, 0.0, (now - growl.start) - this.lifetime, 'EaseOut', 'Quadratic') ); -} -else { -delete_object(this.growls, { id: growl.id }); -$('d_growl_wrapper').removeChild( div ); -return; -} -var self = this; -setTimeout( function() { self.animate(growl); }, 33 ); -}, -handle_resize: function() { -var div = $('d_growl_wrapper'); -if (this.growls.length) { -var size = getInnerWindowSize(); -div.style.top = '' + (10 + this.marginTop) + 'px'; -div.style.left = '' + Math.floor((size.width - 310) - this.marginRight) + 'px'; -} -else { -div.style.left = '-2000px'; -} -} -} ); -window.$GR = new GrowlManager(); -if (window.addEventListener) { -window.addEventListener( "resize", function() { -$GR.handle_resize(); -}, false ); -} -else if (window.attachEvent && !ie6) { -window.attachEvent("onresize", function() { -$GR.handle_resize(); -}); -} -Class.create( 'Effect.Page', { -ID: '', -data: null, -active: false, -__construct: function(config) { -if (!config) return; -this.data = {}; -if (!config) config = {}; -for (var key in config) this[key] = config[key]; -this.div = $('page_' + this.ID); -assert(this.div, "Cannot find page div: page_" + this.ID); -}, -onInit: function() { -}, -onActivate: function() { -return true; -}, -onDeactivate: function() { -return true; -}, -show: function() { -this.div.show(); -}, -hide: function() { -this.div.hide(); -}, -gosub: function(anchor) { -} -} ); -Class.require( 'Effect.Page' ); -Class.create( 'Effect.PageManager', { -pages: null, -current_page_id: '', -on_demand: {}, -__construct: function(page_list) { -this.pages = []; -this.page_list = page_list; -for (var idx = 0, len = page_list.length; idx < len; idx++) { -Debug.trace( 'page', "Initializing page: " + page_list[idx].ID ); -if (Effect.Page[ page_list[idx].ID ]) { -var page = new Effect.Page[ page_list[idx].ID ]( page_list[idx] ); -page.onInit(); -this.pages.push(page); -} -else { -Debug.trace( 'page', 'Page ' + page_list[idx].ID + ' will be loaded on-demand' ); -} -} -}, -find: function(id) { -var page = find_object( this.pages, { ID: id } ); -if (!page) Debug.trace('PageManager', "Could not find page: " + id); -return page; -}, -notify_load: function(file, id) { -for (var idx = 0, len = this.page_list.length; idx < len; idx++) { -var page_config = this.page_list[idx]; -if (page_config.File == file) { -Debug.trace( 'page', "Initializing page on-demand: " + page_config.ID ); -var page = new Effect.Page[ page_config.ID ]( page_config ); -page.onInit(); -this.pages.push(page); -} -} -var self = this; -setTimeout( function() { -var result = self.activate(id, self.temp_args); -delete self.temp_args; -$('d_page_loading').hide(); -if (!result) { -$('page_'+id).hide(); -self.current_page_id = ''; -} -}, 1 ); -}, -activate: function(id, args) { -if (!find_object( this.pages, { ID: id } )) { -var page_config = find_object( this.page_list, { ID: id } ); -assert(!!page_config, "Page config not found: " + id ); -Debug.trace('page', "Loading file on-demand: " + page_config.File + " for page: " + id); -var url = '/effect/api/load_page/' + page_config.File + '?onafter=' + escape('page_manager.notify_load(\''+page_config.File+'\',\''+id+'\')'); -if (page_config.Requires) { -var files = page_config.Requires.split(/\,\s*/); -for (var idx = 0, len = files.length; idx < len; idx++) { -var filename = files[idx]; -if (!this.on_demand[filename]) { -Debug.trace('page', "Also loading file: " + filename); -url += '&file=' + filename; -this.on_demand[filename] = 1; -} -} -} -$('d_page_loading').show(); -this.temp_args = args; -load_script( url ); -return true; -} -$('page_'+id).show(); -var page = this.find(id); -page.active = true; -if (!args) args = []; -if (!isa_array(args)) args = [ args ]; -var result = page.onActivate.apply(page, args); -if (typeof(result) == 'boolean') return result; -else return alert("Page " + id + " onActivate did not return a boolean!"); -}, -deactivate: function(id, new_id) { -var page = this.find(id); -var result = page.onDeactivate(new_id); -if (result) { -$('page_'+id).hide(); -page.active = false; -} -return result; -}, -click: function(id, args) { -Debug.trace('page', "Switching pages to: " + id); -var old_id = this.current_page_id; -if (this.current_page_id) { -var result = this.deactivate( this.current_page_id, id ); -if (!result) return false; -} -this.current_page_id = id; -this.old_page_id = old_id; -window.scrollTo( 0, 0 ); -var result = this.activate(id, args); -if (!result) { -$('page_'+id).hide(); -this.current_page_id = ''; -} -return true; -} -} ); -Class.subclass( Effect.Page, "Effect.Page.Main", { -inited: false, -onActivate: function() { -Nav.bar( ['Main', 'EffectGames.com'] ); -Nav.title(''); -$('d_blog_news').innerHTML = loading_image(); -$('d_blog_community').innerHTML = loading_image(); -$('d_blog_featured').innerHTML = loading_image(); -Blog.search({ -stag: 'featured_game', -limit: 4, -full: 1, -callback: [this, 'receive_featured_games'] -}); -effect_api_get( 'get_site_info', { cat: 'pop_pub_games' }, [this, 'receive_pop_pub_games'], { } ); -Blog.search({ -stag: 'front_page', -limit: 5, -target: 'd_blog_news', -more: 1 -}); -Blog.search({ -path: '/community', -limit: 5, -target: 'd_blog_community', -more: 1 -}); -if (!this.inited) { -this.inited = true; -config.Strings.MainSlideshow.Slide = always_array( config.Strings.MainSlideshow.Slide ); -this.slide_idx = 0; -this.num_slides = config.Strings.MainSlideshow.Slide.length; -this.slide_div_num = 0; -this.slide_dir = 1; -this.bk_pos = -340; -this.bk_pos_target = -340; -this.slide_images = []; -for (var idx = 0, len = this.num_slides; idx < len; idx++) { -var url = images_uri + '/' + config.Strings.MainSlideshow.Slide[idx].Photo; -this.slide_images[idx] = new Image(); -this.slide_images[idx].src = png(url, true); -} -} -this.height_target = 470; -this.height_start = $('d_header').offsetHeight; -this.time_start = hires_time_now(); -this.duration = 0.75; -if (!this.timer) this.timer = setTimeout( '$P("Main").animate_mhs()', 33 ); -if (session.user) $('d_blurb_main').hide(); -else { -$('d_blurb_main').innerHTML = get_string('/Main/Blurb'); -$('d_blurb_main').show(); -} -return true; -}, -receive_pop_pub_games: function(response, tx) { -var html = ''; -if (response.Data && response.Data.Games && response.Data.Games.Game) { -var games = always_array( response.Data.Games.Game ); -for (var idx = 0, len = Math.min(games.length, 16); idx < len; idx++) { -var game = games[idx]; -html += '
          ' + -(game.Logo ? -user_image_thumbnail(game.Logo, 80, 60) : -'' -) + '
          ' + ww_fit_box(game.Title, 80, 2, session.em_width, 1) + '
          '; -} -html += '
          '; -} -else { -html += 'No active public games found! Why not create a new one?'; -} -$('d_main_pop_pub_games').innerHTML = html; -}, -receive_featured_games: function(response, tx) { -var html = ''; -if (response.Rows && response.Rows.Row) { -html += ''; -var rows = always_array( response.Rows.Row ); -for (var idx = 0, len = rows.length; idx < len; idx++) { -var row = rows[idx]; -var image_url = row.Params.featured_image; -if (image_url && image_url.match(/^(\w+)\/(\w+\.\w+)$/)) { -image_url = '/effect/api/view/users/' + RegExp.$1 + '/images/' + RegExp.$2; -} -if (idx % 2 == 0) html += ''; -html += ''; -if (idx % 2 == 1) html += ''; -} -if (rows.length % 2 == 1) { -html += ''; -html += ''; -} -html += '
          '; -html += ''; -html += ''; -html += ''; -html += ''; -html += ''; -html += '
          '; -html += ''; -html += '' + spacer(10,1) + ''; -html += ''; -html += ''; -html += '' + spacer(15,1) + '
          '; -html += spacer(1,20); -html += '
          '; -} -$('d_blog_featured').innerHTML = html; -}, -animate_mhs: function() { -var now = hires_time_now(); -if (now - this.time_start >= this.duration) { -$('d_header').style.height = '' + this.height_target + 'px'; -$('d_shadow').style.height = '' + this.height_target + 'px'; -delete this.timer; -} -else { -var height = tweenFrame(this.height_start, this.height_target, (now - this.time_start) / this.duration, 'EaseOut', 'Circular'); -$('d_header').style.height = '' + height + 'px'; -$('d_shadow').style.height = '' + height + 'px'; -this.timer = setTimeout( '$P("Main").animate_mhs()', 33 ); -} -}, -onDeactivate: function() { -$('d_blog_news').innerHTML = ''; -$('d_blog_community').innerHTML = ''; -this.height_target = 75; -this.height_start = $('d_header').offsetHeight; -this.time_start = hires_time_now(); -if (!this.timer) this.timer = setTimeout( '$P("Main").animate_mhs()', 33 ); -return true; -}, -draw_slide: function() { -if (this.slide_timer) return; -var slide = config.Strings.MainSlideshow.Slide[ this.slide_idx ]; -this.old_photo = $('d_header_slideshow_photo_' + this.slide_div_num); -this.old_text = $('d_header_slideshow_text_' + this.slide_div_num); -this.slide_div_num = 1 - this.slide_div_num; -this.new_photo = $('d_header_slideshow_photo_' + this.slide_div_num); -this.new_text = $('d_header_slideshow_text_' + this.slide_div_num); -this.new_photo.style.backgroundImage = 'url('+png(images_uri+'/'+slide.Photo, true)+')'; -this.new_photo.setOpacity(0.0); -var html = ''; -html += slide.Text; -this.slide_width = this.new_text.offsetWidth; -this.new_text.innerHTML = html; -if (this.slide_dir == 1) this.new_text.style.left = '' + this.slide_width + 'px'; -else this.new_text.style.left = '-' + this.slide_width + 'px'; -this.slide_time_start = hires_time_now(); -this.slide_timer = setTimeout( '$P("Main").animate_mhs_slide()', 33 ); -}, -animate_mhs_slide: function() { -var now = hires_time_now(); -if (now - this.slide_time_start >= this.duration) { -this.new_text.style.left = '0px'; -this.old_text.style.left = '-' + this.slide_width + 'px'; -this.new_photo.setOpacity( 1.0 ); -this.old_photo.setOpacity( 0.0 ); -delete this.slide_timer; -this.bk_pos = this.bk_pos_target; -} -else { -var value = tweenFrame(0.0, 1.0, (now - this.slide_time_start) / this.duration, 'EaseOut', 'Circular'); -if (this.slide_dir == 1) { -this.new_text.style.left = '' + Math.floor( this.slide_width - (this.slide_width * value) ) + 'px'; -this.old_text.style.left = '-' + Math.floor( this.slide_width * value ) + 'px'; -} -else { -this.new_text.style.left = '-' + Math.floor( this.slide_width - (this.slide_width * value) ) + 'px'; -this.old_text.style.left = '' + Math.floor( this.slide_width * value ) + 'px'; -} -this.new_photo.setOpacity( value ); -this.old_photo.setOpacity( 1.0 - value ); -var bkp = Math.floor( this.bk_pos + ((this.bk_pos_target - this.bk_pos) * value) ); -$('d_header').style.backgroundPosition = '' + bkp + 'px 0px'; -this.slide_timer = setTimeout( '$P("Main").animate_mhs_slide()', 33 ); -} -}, -prev_slide: function() { -this.bk_pos_target += 200; -this.slide_idx--; -if (this.slide_idx < 0) this.slide_idx += this.num_slides; -this.slide_dir = -1; -this.draw_slide(); -}, -next_slide: function() { -this.bk_pos_target -= 200; -this.slide_idx++; -if (this.slide_idx >= this.num_slides) this.slide_idx -= this.num_slides; -this.slide_dir = 1; -this.draw_slide(); -} -} ); -Class.subclass( Effect.Page, "Effect.Page.PublicGameList", { -onActivate: function() { -Nav.bar( -['Main', 'EffectGames.com'], -['PublicGameList', "All Public Games"] -); -Nav.title( "List of All Public Game Projects" ); -effect_api_get( 'get_site_info', { cat: 'all_pub_games' }, [this, 'receive_all_pub_games'], { } ); -this.div.innerHTML = loading_image(); -return true; -}, -onDeactivate: function() { -this.div.innerHTML = ''; -return true; -}, -receive_all_pub_games: function(response, tx) { -var html = ''; -html += '

          List of All Public Game Projects

          '; -html += '
          This is the complete list of public games currently being built by our users, presented in alphabetical order. Maybe they could use some help! Check out the game project pages and see (requires user account).
          '; -if (response.Data && response.Data.Games && response.Data.Games.Game) { -var games = always_array( response.Data.Games.Game ); -for (var idx = 0, len = games.length; idx < len; idx++) { -var game = games[idx]; -html += '
          ' + -(game.Logo ? -user_image_thumbnail(game.Logo, 80, 60) : -'' -) + '
          ' + ww_fit_box(game.Title, 80, 2, session.em_width, 1) + '
          '; -} -html += '
          '; -} -else { -html += 'No public games found! Why not create a new one?'; -} -this.div.innerHTML = html; -} -} ); -Class.subclass( Effect.Page, "Effect.Page.Search", { -onActivate: function(args) { -if (!args) args = {}; -var search_text = args.q; -var start = args.s || 0; -if (!start) start = 0; -var title = 'Search results for "'+search_text+'"'; -Nav.bar( -['Main', 'EffectGames.com'], -['Search?q=' + escape(search_text), "Search Results"] -); -Nav.title( title ); -this.last_search_text = search_text; -$('d_article_search').innerHTML = loading_image(); -load_script( 'http://www.google.com/uds/GwebSearch?callback=receive_google_search_results&context=0&lstkp=0&rsz=large&hl=en&source=gsc&gss=.com&sig=&q='+escape(search_text)+'%20site%3Ahttp%3A%2F%2Fwww.effectgames.com%2F&key=notsupplied&v=1.0&start='+start+'&nocache=' + (new Date()).getTime() ); -$('h_article_search').innerHTML = title; -return true; -}, -onDeactivate: function(new_page) { -$('fe_search_bar').value = ''; -$('d_article_search').innerHTML = ''; -return true; -} -} ); -function do_search_bar() { -var search_text = $('fe_search_bar').value; -if (search_text.length) { -Nav.go('Search?q=' + escape(search_text)); -} -} -function receive_google_search_results(context, response) { -var html = ''; -html += '
          Powered by
          '; -if (response.results.length) { -for (var idx = 0, len = response.results.length; idx < len; idx++) { -var row = response.results[idx]; -var url = row.unescapedUrl.replace(/^.+article\.psp\.html/, '#Article'); -html += '
          '; -html += ''; -html += '
          ' + row.content + '
          '; -html += '
          '; -} -} -else { -html += 'No results found.'; -} -if (response.cursor.pages) { -html += '
          Page: '; -for (var idx = 0, len = response.cursor.pages.length; idx < len; idx++) { -html += ''; -var page = response.cursor.pages[idx]; -var url = '#Search?q=' + escape($P('Search').last_search_text) + '&s=' + page.start; -if (response.cursor.currentPageIndex != idx) html += ''; -else html += ''; -html += page.label; -if (response.cursor.currentPageIndex != idx) html += ''; -else html += ''; -html += ''; -} -html += '
          '; -} -$('d_article_search').innerHTML = html; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/index.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/index.js deleted file mode 100644 index 8b164a42..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/index.js +++ /dev/null @@ -1 +0,0 @@ -exports.ZeParser = require('./ZeParser').ZeParser; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/package.json deleted file mode 100644 index 48d8d347..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": { - "name": "Peter van der Zee", - "url": "http://qfox.nl/" - }, - "name": "zeparser", - "description": "My JavaScript parser", - "version": "0.0.5", - "homepage": "https://github.com/qfox/ZeParser/", - "repository": { - "type": "git", - "url": "git://github.com/qfox/ZeParser.git" - }, - "main": "./index", - "engines": { - "node": "*" - }, - "dependencies": {}, - "devDependencies": {}, - "_id": "zeparser@0.0.5", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "f44c5060426ea475f6d3deb7c0f286144d573533" - }, - "_from": "zeparser@0.0.5" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/test-parser.html b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/test-parser.html deleted file mode 100644 index 1ff5ff43..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/test-parser.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - Parser Test Suite Page - - - - (c) qfox.nl
          - Parser test suite
          -
          Running...
          - - - - - - - \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/test-tokenizer.html b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/test-tokenizer.html deleted file mode 100644 index 0e0d1b1a..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/test-tokenizer.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - Tokenizer Test Suite Page - - - - (c) qfox.nl
          - - - - - - \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/tests.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/tests.js deleted file mode 100644 index 8a4138be..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/tests.js +++ /dev/null @@ -1,478 +0,0 @@ -// tests for both the tokenizer and parser. Parser test results could be checked tighter. -// api: [input, token-output-count, ?regex-hints, desc] -// regex-hints are for tokenizer, will tell for each token whether it might parse regex or not (parser's job) -var Tests = [ - -["var abc;", 4, "Variable Declaration"], -["var abc = 5;", 8, "Variable Declaration, Assignment"], -["/* */", 1, "Block Comment"], -["/** **/", 1, "JSDoc-style Comment"], -["var f = function(){;};", 13, "Assignment, Function Expression"], -["hi; // moo", 4, "Trailing Line Comment"], -["hi; // moo\n;", 6, "Trailing Line Comment, Linefeed, `;`"], -["var varwithfunction;", 4, "Variable Declaration, Identifier Containing Reserved Words, `;`"], -["a + b;", 6, "Addition/Concatenation"], - -["'a'", 1, "Single-Quoted String"], -["'a';", 2, "Single-Quoted String, `;`"], // Taken from the parser test suite. - -["'a\\n'", 1, "Single-Quoted String With Escaped Linefeed"], -["'a\\n';", 2, "Single-Quoted String With Escaped Linefeed, `;`"], // Taken from the parser test suite. - -["\"a\"", 1, "Double-Quoted String"], -["\"a\";", 2, "Double-Quoted String, `;`"], // Taken from the parser test suite. - -["\"a\\n\"", 1, "Double-Quoted String With Escaped Linefeed"], -["\"a\\n\";", 2, "Double-Quoted String With Escaped Linefeed, `;`"], // Taken from the parser test suite. - -["500", 1, "Integer"], -["500;", 2, "Integer, `;`"], // Taken from the parser test suite. - -["500.", 1, "Double With Trailing Decimal Point"], -["500.;", 2, "Double With Trailing Decimal Point"], // Taken from the parser test suite. - -["500.432", 1, "Double With Decimal Component"], -["500.432;", 2, "Double With Decimal Component, `;`"], // Taken from the parser test suite. - -[".432432", 1, "Number, 0 < Double < 1"], -[".432432;", 2, "Number, 0 < Double < 1, `;`"], // Taken from the parser test suite. - -["(a,b,c)", 7, "Parentheses, Comma-separated identifiers"], -["(a,b,c);", 8, "Parentheses, Comma-separated identifiers, `;`"], // Taken from the parser test suite. - -["[1,2,abc]", 7, "Array literal"], -["[1,2,abc];", 8, "Array literal, `;`"], // Taken from the parser test suite. - -["{a:1,\"b\":2,c:c}", 13, "Object literal"], -["var o = {a:1,\"b\":2,c:c};", 20, "Assignment, Object Literal, `;`"], // Taken from the parser test suite. - -["var x;\nvar y;", 9, "2 Variable Declarations, Multiple lines"], -["var x;\nfunction n(){ }", 13, "Variable, Linefeed, Function Declaration"], -["var x;\nfunction n(abc){ }", 14, "Variable, Linefeed, Function Declaration With One Argument"], -["var x;\nfunction n(abc, def){ }", 17, "Variable, Linefeed, Function Declaration With Multiple Arguments"], -["function n(){ \"hello\"; }", 11, "Function Declaration, Body"], - -["/a/;", 2, [true, false], "RegExp Literal, `;`"], -["/a/b;", 2, [true, true], "RegExp Literal, Flags, `;`"], -["++x;", 3, "Unary Increment, Prefix, `;`"], -[" / /;", 3, [true, true, false], "RegExp, Leading Whitespace, `;`"], -["/ / / / /", 5, [true, false, false, false, true], "RegExp Containing One Space, Space, Division, Space, RegExp Containing One Space"], - -// Taken from the parser test suite. - -["\"var\";", 2, "Keyword String, `;`"], -["\"variable\";", 2, "String Beginning With Keyword, `;`"], -["\"somevariable\";", 2, "String Containing Keyword, `;`"], -["\"somevar\";", 2, "String Ending With Keyword, `;`"], - -["var varwithfunction;", 4, "Keywords should not be matched in identifiers"], - -["var o = {a:1};", 12, "Object Literal With Unquoted Property"], -["var o = {\"b\":2};", 12, "Object Literal With Quoted Property"], -["var o = {c:c};", 12, "Object Literal With Equivalent Property Name and Identifier"], - -["/a/ / /b/;", 6, [true, true, false, false, true, false], "RegExp, Division, RegExp, `;`"], -["a/b/c;", 6, "Triple Division (Identifier / Identifier / Identifier)"], - -["+function(){/regex/;};", 9, [false, false, false, false, false, true, false, false, false], "Unary `+` Operator, Function Expression Containing RegExp and Semicolon, `;`"], - -// Line Terminators. -["\r\n", 1, "CRLF Line Ending = 1 Linefeed"], -["\r", 1, "CR Line Ending = 1 Linefeed"], -["\n", 1, "LF Line Ending = 1 Linefeed"], -["\r\n\n\u2028\u2029\r", 5, "Various Line Terminators"], - -// Whitespace. -["a \t\u000b\u000c\u00a0\uFFFFb", 8, "Whitespace"], - -// Comments. -["//foo!@#^&$1234\nbar;", 4, "Line Comment, Linefeed, Identifier, `;`"], -["/* abcd!@#@$* { } && null*/;", 2, "Single-Line Block Comment, `;`"], -["/*foo\nbar*/;", 2, "Multi-Line Block Comment, `;`"], -["/*x*x*/;", 2, "Block Comment With Asterisks, `;`"], -["/**/;", 2, "Empty Comment, `;`"], - -// Identifiers. -["x;", 2, "Single-Character Identifier, `;`"], -["_x;", 2, "Identifier With Leading `_`, `;`"], -["xyz;", 2, "Identifier With Letters Only, `;`"], -["$x;", 2, "Identifier With Leading `$`, `;`"], -["x5;", 2, "Identifier With Number As Second Character, `;`"], -["x_y;", 2, "Identifier Containing `_`, `;`"], -["x+5;", 4, "Identifier, Binary `+` Operator, Identifier, `;`"], -["xyz123;", 2, "Alphanumeric Identifier, `;`"], -["x1y1z1;", 2, "Alternating Alphanumeric Identifier, `;`"], -["foo\\u00d8bar;", 2, "Identifier With Unicode Escape Sequence (`\\uXXXX`), `;`"], -["f\u00d8\u00d8bar;", 2, "Identifier With Embedded Unicode Character"], - -// Numbers. -["5;", 2, "Integer, `;`"], -["5.5;", 2, "Double, `;`"], -["0;", 2, "Integer Zero, `;`"], -["0.0;", 2, "Double Zero, `;`"], -["0.001;", 2, "0 < Decimalized Double < 1, `;`"], -["1.e2;", 2, "Integer With Decimal and Exponential Component (`e`), `;`"], -["1.e-2;", 2, "Integer With Decimal and Negative Exponential Component, `;`"], -["1.E2;", 2, "Integer With Decimal and Uppercase Exponential Component (`E`), `;`"], -["1.E-2;", 2, "Integer With Decimal and Uppercase Negative Exponential Component, `;`"], -[".5;", 2, "0 < Double < 1, `;`"], -[".5e3;", 2, "(0 < Double < 1) With Exponential Component"], -[".5e-3;", 2, "(0 < Double < 1) With Negative Exponential Component"], -["0.5e3;", 2, "(0 < Decimalized Double < 1) With Exponential Component"], -["55;", 2, "Two-Digit Integer, `;`"], -["123;", 2, "Three-Digit Integer, `;`"], -["55.55;", 2, "Two-Digit Double, `;`"], -["55.55e10;", 2, "Two-Digit Double With Exponential Component, `;`"], -["123.456;", 2, "Three-Digit Double, `;`"], -["1+e;", 4, "Additive Expression, `;`"], -["0x01;", 2, "Hexadecimal `1` With 1 Leading Zero, `;`"], -["0xcafe;", 2, "Hexadecimal `51966`, `;`"], -["0x12345678;", 2, "Hexadecimal `305419896`, `;`"], -["0x1234ABCD;", 2, "Hexadecimal `305441741` With Uppercase Letters, `;`"], -["0x0001;", 2, "Hexadecimal `1` with 3 Leading Zeros, `;`"], - -// Strings. -["\"foo\";", 2, "Multi-Character Double-Quoted String, `;`"], -["\"a\\n\";", 2, "Double-Quoted String Containing Linefeed, `;`"], -["\'foo\';", 2, "Single-Quoted String, `;`"], -["'a\\n';", 2, "Single-Quoted String Containing Linefeed, `;`"], -["\"x\";", 2, "Single-Character Double-Quoted String, `;`"], -["'';", 2, "Empty Single-Quoted String, `;`"], -["\"foo\\tbar\";", 2, "Double-Quoted String With Tab Character, `;`"], -["\"!@#$%^&*()_+{}[]\";", 2, "Double-Quoted String Containing Punctuators, `;`"], -["\"/*test*/\";", 2, "Double-Quoted String Containing Block Comment, `;`"], -["\"//test\";", 2, "Double-Quoted String Containing Line Comment, `;`"], -["\"\\\\\";", 2, "Double-Quoted String Containing Reverse Solidus, `;`"], -["\"\\u0001\";", 2, "Double-Quoted String Containing Numeric Unicode Escape Sequence, `;`"], -["\"\\uFEFF\";", 2, "Double-Quoted String Containing Alphanumeric Unicode Escape Sequence, `;`"], -["\"\\u10002\";", 2, "Double-Quoted String Containing 5-Digit Unicode Escape Sequence, `;`"], -["\"\\x55\";", 2, "Double-Quoted String Containing Hex Escape Sequence, `;`"], -["\"\\x55a\";", 2, "Double-Quoted String Containing Hex Escape Sequence and Additional Character, `;`"], -["\"a\\\\nb\";", 2, "Double-Quoted String Containing Escaped Linefeed, `;`"], -["\";\"", 1, "Double-Quoted String Containing `;`"], -["\"a\\\nb\";", 2, "Double-Quoted String Containing Reverse Solidus and Linefeed, `;`"], -["'\\\\'+ ''", 4, "Single-Quoted String Containing Reverse Solidus, `+`, Empty Single-Quoted String"], - -// `null`, `true`, and `false`. -["null;", 2, "`null`, `;`"], -["true;", 2, "`true`, `;`"], -["false;", 2, "`false`, `;`"], - -// RegExps -["/a/;", 2, [true, true], "Single-Character RegExp, `;`"], -["/abc/;", 2, [true, true], "Multi-Character RegExp, `;`"], -["/abc[a-z]*def/g;", 2, [true, true], "RegExp Containing Character Range and Quantifier, `;`"], -["/\\b/;", 2, [true, true], "RegExp Containing Control Character, `;`"], -["/[a-zA-Z]/;", 2, [true, true], "RegExp Containing Extended Character Range, `;`"], -["/foo(.*)/g;", 2, [true, false], "RegExp Containing Capturing Group and Quantifier, `;`"], - -// Array Literals. -["[];", 3, "Empty Array, `;`"], -["[\b\n\f\r\t\x20];", 9, "Array Containing Whitespace, `;`"], -["[1];", 4, "Array Containing 1 Element, `;`"], -["[1,2];", 6, "Array Containing 2 Elements, `;`"], -["[1,2,,];", 8, "Array Containing 2 Elisions, `;`"], -["[1,2,3];", 8, "Array Containing 3 Elements, `;`"], -["[1,2,3,,,];", 11, "Array Containing 3 Elisions, `;`"], - -// Object Literals. -["({x:5});", 8, "Object Literal Containing 1 Member; `;`"], -["({x:5,y:6});", 12, "Object Literal Containing 2 Members, `;`"], -["({x:5,});", 9, "Object Literal Containing 1 Member and Trailing Comma, `;`"], -["({if:5});", 8, "Object Literal Containing Reserved Word Property Name, `;`"], -["({ get x() {42;} });", 17, "Object Literal Containing Getter, `;`"], -["({ set y(a) {1;} });", 18, "Object Literal Containing Setter, `;`"], - -// Member Expressions. -["o.m;", 4, "Dot Member Accessor, `;`"], -["o['m'];", 5, "Square Bracket Member Accessor, `;`"], -["o['n']['m'];", 8, "Nested Square Bracket Member Accessor, `;`"], -["o.n.m;", 6, "Nested Dot Member Accessor, `;`"], -["o.if;", 4, "Dot Reserved Property Name Accessor, `;`"], - -// Function Calls. -["f();", 4, "Function Call Operator, `;`"], -["f(x);", 5, "Function Call Operator With 1 Argument, `;`"], -["f(x,y);", 7, "Function Call Operator With Multiple Arguments, `;`"], -["o.m();", 6, "Dot Member Accessor, Function Call, `;`"], -["o['m']();", 7, "Square Bracket Member Accessor, Function Call, `;`"], -["o.m(x);", 7, "Dot Member Accessor, Function Call With 1 Argument, `;`"], -["o['m'](x);", 8, "Square Bracket Member Accessor, Function Call With 1 Argument, `;`"], -["o.m(x,y);", 9, "Dot Member Accessor, Function Call With 2 Arguments, `;`"], -["o['m'](x,y);", 10, "Square Bracket Member Accessor, Function Call With 2 Arguments, `;`"], -["f(x)(y);", 8, "Nested Function Call With 1 Argument Each, `;`"], -["f().x;", 6, "Function Call, Dot Member Accessor, `;`"], - -// `eval` Function. -["eval('x');", 5, "`eval` Invocation With 1 Argument, `;`"], -["(eval)('x');", 7, "Direct `eval` Call Example, `;`"], -["(1,eval)('x');", 9, "Indirect `eval` Call Example, `;`"], -["eval(x,y);", 7, "`eval` Invocation With 2 Arguments, `;`"], - -// `new` Operator. -["new f();", 6, "`new` Operator, Function Call, `;`"], -["new o;", 4, "`new` Operator, Identifier, `;`"], -["new o.m;", 6, "`new` Operator, Dot Member Accessor, `;`"], -["new o.m(x);", 9, "`new` Operator, Dot Member Accessor, Function Call With 1 Argument, `;`"], -["new o.m(x,y);", 11, "``new` Operator, Dot Member Accessor, Function Call With 2 Arguments , `;`"], - -// Prefix and Postfix Increment. -["++x;", 3, "Prefix Increment, Identifier, `;`"], -["x++;", 3, "Identifier, Postfix Increment, `;`"], -["--x;", 3, "Prefix Decrement, Identifier, `;`"], -["x--;", 3, "Postfix Decrement, Identifier, `;`"], -["x ++;", 4, "Identifier, Space, Postfix Increment, `;`"], -["x /* comment */ ++;", 6, "Identifier, Block Comment, Postfix Increment, `;`"], -["++ /* comment */ x;", 6, "Prefix Increment, Block Comment, Identifier, `;`"], - -// Unary Operators. -["delete x;", 4, "`delete` Operator, Space, Identifier, `;`"], -["void x;", 4, "`void` Operator, Space, Identifier, `;`"], -["typeof x;", 4, "`typeof` Operator, Space, Identifier, `;`"], -["+x;", 3, "Unary `+` Operator, Identifier, `;`"], -["-x;", 3, "Unary Negation Operator, Identifier, `;`"], -["~x;", 3, "Bitwise NOT Operator, Identifier, `;`"], -["!x;", 3, "Logical NOT Operator, Identifier, `;`"], - -// Comma Operator. -["x, y;", 5, "Comma Operator"], - -// Miscellaneous. -["new Date++;", 5, "`new` Operator, Identifier, Postfix Increment, `;`"], -["+x++;", 4, "Unary `+`, Identifier, Postfix Increment, `;`"], - -// Expressions. -["1 * 2;", 6, "Integer, Multiplication, Integer, `;`"], -["1 / 2;", 6, "Integer, Division, Integer, `;`"], -["1 % 2;", 6, "Integer, Modulus, Integer, `;`"], -["1 + 2;", 6, "Integer, Addition, Integer, `;`"], -["1 - 2;", 6, "Integer, Subtraction, Integer, `;`"], -["1 << 2;", 6, "Integer, Bitwise Left Shift, Integer, `;`"], -["1 >>> 2;", 6, "Integer, Bitwise Zero-fill Right Shift, Integer, `;`"], -["1 >> 2;", 6, "Integer, Bitwise Sign-Propagating Right Shift, Integer, `;`"], -["1 * 2 + 3;", 10, "Order-of-Operations Expression, `;`"], -["(1+2)*3;", 8, "Parenthesized Additive Expression, Multiplication, `;`"], -["1*(2+3);", 8, "Multiplication, Parenthesized Additive Expression, `;`"], -["xy;", 4, "Greater-Than Relational Operator, `;`"], -["x<=y;", 4, "Less-Than-or-Equal-To Relational Operator, `;`"], -["x>=y;", 4, "Greater-Than-or-Equal-To Relational Operator, `;`"], -["x instanceof y;", 6, "`instanceof` Operator, `;`"], -["x in y;", 6, "`in` Operator, `;`"], -["x&y;", 4, "Bitwise AND Operator, `;`"], -["x^y;", 4, "Bitwise XOR Operator, `;`"], -["x|y;", 4, "Bitwise OR Operator, `;`"], -["x+y>>= y;", 6, "Bitwise Zero-Fill Right Shift Assignment, `;`"], -["x <<= y;", 6, "Bitwise Left Shift Assignment, `;`"], -["x += y;", 6, "Additive Assignment, `;`"], -["x -= y;", 6, "Subtractive Assignment, `;`"], -["x *= y;", 6, "Multiplicative Assignment, `;`"], -["x /= y;", 6, "Divisive Assignment, `;`"], -["x %= y;", 6, "Modulus Assignment, `;`"], -["x >>= y;", 6, "Bitwise Sign-Propagating Right Shift Assignment, `;`"], -["x &= y;", 6, "Bitwise AND Assignment, `;`"], -["x ^= y;", 6, "Bitwise XOR Assignment, `;`"], -["x |= y;", 6, "Bitwise OR Assignment, `;`"], - -// Blocks. -["{};", 3, "Empty Block, `;`"], -["{x;};", 5, "Block Containing 1 Identifier, `;`"], -["{x;y;};", 7, "Block Containing 2 Identifiers, `;`"], - -// Variable Declarations. -["var abc;", 4, "Variable Declaration"], -["var x,y;", 6, "Comma-Separated Variable Declarations, `;`"], -["var x=1,y=2;", 10, "Comma-Separated Variable Initializations, `;`"], -["var x,y=2;", 8, "Variable Declaration, Variable Initialization, `;`"], - -// Empty Statements. -[";", 1, "Empty Statement"], -["\n;", 2, "Linefeed, `;`"], - -// Expression Statements. -["x;", 2, "Identifier, `;`"], -["5;", 2, "Integer, `;`"], -["1+2;", 4, "Additive Statement, `;`"], - -// `if...else` Statements. -["if (c) x; else y;", 13, "Space-Delimited `if...else` Statement"], -["if (c) x;", 8, "Space-Delimited `if` Statement, `;`"], -["if (c) {} else {};", 14, "Empty Block-Delimited `if...else` Statement"], -["if (c1) if (c2) s1; else s2;", 19, "Nested `if...else` Statement Without Dangling `else`"], - -// `while` and `do...while` Loops. -["do s; while (e);", 11, "Space-Delimited `do...while` Loop"], -["do { s; } while (e);", 15, "Block-Delimited `do...while` Loop"], -["while (e) s;", 8, "Space-Delimited `while` Loop"], -["while (e) { s; };", 13, "Block-Delimited `while` Loop"], - -// `for` and `for...in` Loops. -["for (;;) ;", 8, "Infinite Space-Delimited `for` Loop"], -["for (;c;x++) x;", 12, "`for` Loop: Empty Initialization Condition; Space-Delimited Body"], -["for (i;i - - - -UglifyJS – a JavaScript parser/compressor/beautifier - - - - - - - - - - - - - -
          - -
          - -
          -

          UglifyJS – a JavaScript parser/compressor/beautifier

          - - - - -
          -

          1 UglifyJS — a JavaScript parser/compressor/beautifier

          -
          - - -

          -This package implements a general-purpose JavaScript -parser/compressor/beautifier toolkit. It is developed on NodeJS, but it -should work on any JavaScript platform supporting the CommonJS module system -(and if your platform of choice doesn't support CommonJS, you can easily -implement it, or discard the exports.* lines from UglifyJS sources). -

          -

          -The tokenizer/parser generates an abstract syntax tree from JS code. You -can then traverse the AST to learn more about the code, or do various -manipulations on it. This part is implemented in parse-js.js and it's a -port to JavaScript of the excellent parse-js Common Lisp library from Marijn Haverbeke. -

          -

          -( See cl-uglify-js if you're looking for the Common Lisp version of -UglifyJS. ) -

          -

          -The second part of this package, implemented in process.js, inspects and -manipulates the AST generated by the parser to provide the following: -

          -
            -
          • ability to re-generate JavaScript code from the AST. Optionally - indented—you can use this if you want to “beautify” a program that has - been compressed, so that you can inspect the source. But you can also run - our code generator to print out an AST without any whitespace, so you - achieve compression as well. - -
          • -
          • shorten variable names (usually to single characters). Our mangler will - analyze the code and generate proper variable names, depending on scope - and usage, and is smart enough to deal with globals defined elsewhere, or - with eval() calls or with{} statements. In short, if eval() or - with{} are used in some scope, then all variables in that scope and any - variables in the parent scopes will remain unmangled, and any references - to such variables remain unmangled as well. - -
          • -
          • various small optimizations that may lead to faster code but certainly - lead to smaller code. Where possible, we do the following: - -
              -
            • foo["bar"] ==> foo.bar - -
            • -
            • remove block brackets {} - -
            • -
            • join consecutive var declarations: - var a = 10; var b = 20; ==> var a=10,b=20; - -
            • -
            • resolve simple constant expressions: 1 +2 * 3 ==> 7. We only do the - replacement if the result occupies less bytes; for example 1/3 would - translate to 0.333333333333, so in this case we don't replace it. - -
            • -
            • consecutive statements in blocks are merged into a sequence; in many - cases, this leaves blocks with a single statement, so then we can remove - the block brackets. - -
            • -
            • various optimizations for IF statements: - -
                -
              • if (foo) bar(); else baz(); ==> foo?bar():baz(); -
              • -
              • if (!foo) bar(); else baz(); ==> foo?baz():bar(); -
              • -
              • if (foo) bar(); ==> foo&&bar(); -
              • -
              • if (!foo) bar(); ==> foo||bar(); -
              • -
              • if (foo) return bar(); else return baz(); ==> return foo?bar():baz(); -
              • -
              • if (foo) return bar(); else something(); ==> {if(foo)return bar();something()} - -
              • -
              - -
            • -
            • remove some unreachable code and warn about it (code that follows a - return, throw, break or continue statement, except - function/variable declarations). - -
            • -
            • act a limited version of a pre-processor (c.f. the pre-processor of - C/C++) to allow you to safely replace selected global symbols with - specified values. When combined with the optimisations above this can - make UglifyJS operate slightly more like a compilation process, in - that when certain symbols are replaced by constant values, entire code - blocks may be optimised away as unreachable. -
            • -
            - -
          • -
          - - - -
          - -
          -

          1.1 Unsafe transformations

          -
          - - -

          -The following transformations can in theory break code, although they're -probably safe in most practical cases. To enable them you need to pass the ---unsafe flag. -

          - -
          - -
          -

          1.1.1 Calls involving the global Array constructor

          -
          - - -

          -The following transformations occur: -

          - - - -
          new Array(1, 2, 3, 4)  => [1,2,3,4]
          -Array(a, b, c)         => [a,b,c]
          -new Array(5)           => Array(5)
          -new Array(a)           => Array(a)
          -
          - - -

          -These are all safe if the Array name isn't redefined. JavaScript does allow -one to globally redefine Array (and pretty much everything, in fact) but I -personally don't see why would anyone do that. -

          -

          -UglifyJS does handle the case where Array is redefined locally, or even -globally but with a function or var declaration. Therefore, in the -following cases UglifyJS doesn't touch calls or instantiations of Array: -

          - - - -
          // case 1.  globally declared variable
          -  var Array;
          -  new Array(1, 2, 3);
          -  Array(a, b);
          -
          -  // or (can be declared later)
          -  new Array(1, 2, 3);
          -  var Array;
          -
          -  // or (can be a function)
          -  new Array(1, 2, 3);
          -  function Array() { ... }
          -
          -// case 2.  declared in a function
          -  (function(){
          -    a = new Array(1, 2, 3);
          -    b = Array(5, 6);
          -    var Array;
          -  })();
          -
          -  // or
          -  (function(Array){
          -    return Array(5, 6, 7);
          -  })();
          -
          -  // or
          -  (function(){
          -    return new Array(1, 2, 3, 4);
          -    function Array() { ... }
          -  })();
          -
          -  // etc.
          -
          - - -
          - -
          - -
          -

          1.1.2 obj.toString() ==> obj+“”

          -
          - - -
          -
          - -
          - -
          -

          1.2 Install (NPM)

          -
          - - -

          -UglifyJS is now available through NPM — npm install uglify-js should do -the job. -

          -
          - -
          - -
          -

          1.3 Install latest code from GitHub

          -
          - - - - - -
          ## clone the repository
          -mkdir -p /where/you/wanna/put/it
          -cd /where/you/wanna/put/it
          -git clone git://github.com/mishoo/UglifyJS.git
          -
          -## make the module available to Node
          -mkdir -p ~/.node_libraries/
          -cd ~/.node_libraries/
          -ln -s /where/you/wanna/put/it/UglifyJS/uglify-js.js
          -
          -## and if you want the CLI script too:
          -mkdir -p ~/bin
          -cd ~/bin
          -ln -s /where/you/wanna/put/it/UglifyJS/bin/uglifyjs
          -  # (then add ~/bin to your $PATH if it's not there already)
          -
          - - -
          - -
          - -
          -

          1.4 Usage

          -
          - - -

          -There is a command-line tool that exposes the functionality of this library -for your shell-scripting needs: -

          - - - -
          uglifyjs [ options... ] [ filename ]
          -
          - - -

          -filename should be the last argument and should name the file from which -to read the JavaScript code. If you don't specify it, it will read code -from STDIN. -

          -

          -Supported options: -

          -
            -
          • -b or --beautify — output indented code; when passed, additional - options control the beautifier: - -
              -
            • -i N or --indent N — indentation level (number of spaces) - -
            • -
            • -q or --quote-keys — quote keys in literal objects (by default, - only keys that cannot be identifier names will be quotes). - -
            • -
            - -
          • -
          • --ascii — pass this argument to encode non-ASCII characters as - \uXXXX sequences. By default UglifyJS won't bother to do it and will - output Unicode characters instead. (the output is always encoded in UTF8, - but if you pass this option you'll only get ASCII). - -
          • -
          • -nm or --no-mangle — don't mangle names. - -
          • -
          • -nmf or --no-mangle-functions – in case you want to mangle variable - names, but not touch function names. - -
          • -
          • -ns or --no-squeeze — don't call ast_squeeze() (which does various - optimizations that result in smaller, less readable code). - -
          • -
          • -mt or --mangle-toplevel — mangle names in the toplevel scope too - (by default we don't do this). - -
          • -
          • --no-seqs — when ast_squeeze() is called (thus, unless you pass - --no-squeeze) it will reduce consecutive statements in blocks into a - sequence. For example, "a = 10; b = 20; foo();" will be written as - "a=10,b=20,foo();". In various occasions, this allows us to discard the - block brackets (since the block becomes a single statement). This is ON - by default because it seems safe and saves a few hundred bytes on some - libs that I tested it on, but pass --no-seqs to disable it. - -
          • -
          • --no-dead-code — by default, UglifyJS will remove code that is - obviously unreachable (code that follows a return, throw, break or - continue statement and is not a function/variable declaration). Pass - this option to disable this optimization. - -
          • -
          • -nc or --no-copyright — by default, uglifyjs will keep the initial - comment tokens in the generated code (assumed to be copyright information - etc.). If you pass this it will discard it. - -
          • -
          • -o filename or --output filename — put the result in filename. If - this isn't given, the result goes to standard output (or see next one). - -
          • -
          • --overwrite — if the code is read from a file (not from STDIN) and you - pass --overwrite then the output will be written in the same file. - -
          • -
          • --ast — pass this if you want to get the Abstract Syntax Tree instead - of JavaScript as output. Useful for debugging or learning more about the - internals. - -
          • -
          • -v or --verbose — output some notes on STDERR (for now just how long - each operation takes). - -
          • -
          • -d SYMBOL[=VALUE] or --define SYMBOL[=VALUE] — will replace - all instances of the specified symbol where used as an identifier - (except where symbol has properly declared by a var declaration or - use as function parameter or similar) with the specified value. This - argument may be specified multiple times to define multiple - symbols - if no value is specified the symbol will be replaced with - the value true, or you can specify a numeric value (such as - 1024), a quoted string value (such as ="object"= or - ='https://github.com'), or the name of another symbol or keyword (such as =null or document). - This allows you, for example, to assign meaningful names to key - constant values but discard the symbolic names in the uglified - version for brevity/efficiency, or when used wth care, allows - UglifyJS to operate as a form of conditional compilation - whereby defining appropriate values may, by dint of the constant - folding and dead code removal features above, remove entire - superfluous code blocks (e.g. completely remove instrumentation or - trace code for production use). - Where string values are being defined, the handling of quotes are - likely to be subject to the specifics of your command shell - environment, so you may need to experiment with quoting styles - depending on your platform, or you may find the option - --define-from-module more suitable for use. - -
          • -
          • -define-from-module SOMEMODULE — will load the named module (as - per the NodeJS require() function) and iterate all the exported - properties of the module defining them as symbol names to be defined - (as if by the --define option) per the name of each property - (i.e. without the module name prefix) and given the value of the - property. This is a much easier way to handle and document groups of - symbols to be defined rather than a large number of --define - options. - -
          • -
          • --unsafe — enable other additional optimizations that are known to be - unsafe in some contrived situations, but could still be generally useful. - For now only these: - -
              -
            • foo.toString() ==> foo+"" -
            • -
            • new Array(x,…) ==> [x,…] -
            • -
            • new Array(x) ==> Array(x) - -
            • -
            - -
          • -
          • --max-line-len (default 32K characters) — add a newline after around - 32K characters. I've seen both FF and Chrome croak when all the code was - on a single line of around 670K. Pass –max-line-len 0 to disable this - safety feature. - -
          • -
          • --reserved-names — some libraries rely on certain names to be used, as - pointed out in issue #92 and #81, so this option allow you to exclude such - names from the mangler. For example, to keep names require and $super - intact you'd specify –reserved-names "require,$super". - -
          • -
          • --inline-script – when you want to include the output literally in an - HTML <script> tag you can use this option to prevent </script from - showing up in the output. - -
          • -
          • --lift-vars – when you pass this, UglifyJS will apply the following - transformations (see the notes in API, ast_lift_variables): - -
              -
            • put all var declarations at the start of the scope -
            • -
            • make sure a variable is declared only once -
            • -
            • discard unused function arguments -
            • -
            • discard unused inner (named) functions -
            • -
            • finally, try to merge assignments into that one var declaration, if - possible. -
            • -
            - -
          • -
          - - - -
          - -
          -

          1.4.1 API

          -
          - - -

          -To use the library from JavaScript, you'd do the following (example for -NodeJS): -

          - - - -
          var jsp = require("uglify-js").parser;
          -var pro = require("uglify-js").uglify;
          -
          -var orig_code = "... JS code here";
          -var ast = jsp.parse(orig_code); // parse code and get the initial AST
          -ast = pro.ast_mangle(ast); // get a new AST with mangled names
          -ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
          -var final_code = pro.gen_code(ast); // compressed code here
          -
          - - -

          -The above performs the full compression that is possible right now. As you -can see, there are a sequence of steps which you can apply. For example if -you want compressed output but for some reason you don't want to mangle -variable names, you would simply skip the line that calls -pro.ast_mangle(ast). -

          -

          -Some of these functions take optional arguments. Here's a description: -

          -
            -
          • jsp.parse(code, strict_semicolons) – parses JS code and returns an AST. - strict_semicolons is optional and defaults to false. If you pass - true then the parser will throw an error when it expects a semicolon and - it doesn't find it. For most JS code you don't want that, but it's useful - if you want to strictly sanitize your code. - -
          • -
          • pro.ast_lift_variables(ast) – merge and move var declarations to the - scop of the scope; discard unused function arguments or variables; discard - unused (named) inner functions. It also tries to merge assignments - following the var declaration into it. - -

            - If your code is very hand-optimized concerning var declarations, this - lifting variable declarations might actually increase size. For me it - helps out. On jQuery it adds 865 bytes (243 after gzip). YMMV. Also - note that (since it's not enabled by default) this operation isn't yet - heavily tested (please report if you find issues!). -

            -

            - Note that although it might increase the image size (on jQuery it gains - 865 bytes, 243 after gzip) it's technically more correct: in certain - situations, dead code removal might drop variable declarations, which - would not happen if the variables are lifted in advance. -

            -

            - Here's an example of what it does: -

          • -
          - - - - - -
          function f(a, b, c, d, e) {
          -    var q;
          -    var w;
          -    w = 10;
          -    q = 20;
          -    for (var i = 1; i < 10; ++i) {
          -        var boo = foo(a);
          -    }
          -    for (var i = 0; i < 1; ++i) {
          -        var boo = bar(c);
          -    }
          -    function foo(){ ... }
          -    function bar(){ ... }
          -    function baz(){ ... }
          -}
          -
          -// transforms into ==>
          -
          -function f(a, b, c) {
          -    var i, boo, w = 10, q = 20;
          -    for (i = 1; i < 10; ++i) {
          -        boo = foo(a);
          -    }
          -    for (i = 0; i < 1; ++i) {
          -        boo = bar(c);
          -    }
          -    function foo() { ... }
          -    function bar() { ... }
          -}
          -
          - - -
            -
          • pro.ast_mangle(ast, options) – generates a new AST containing mangled - (compressed) variable and function names. It supports the following - options: - -
              -
            • toplevel – mangle toplevel names (by default we don't touch them). -
            • -
            • except – an array of names to exclude from compression. -
            • -
            • defines – an object with properties named after symbols to - replace (see the --define option for the script) and the values - representing the AST replacement value. - -
            • -
            - -
          • -
          • pro.ast_squeeze(ast, options) – employs further optimizations designed - to reduce the size of the code that gen_code would generate from the - AST. Returns a new AST. options can be a hash; the supported options - are: - -
              -
            • make_seqs (default true) which will cause consecutive statements in a - block to be merged using the "sequence" (comma) operator - -
            • -
            • dead_code (default true) which will remove unreachable code. - -
            • -
            - -
          • -
          • pro.gen_code(ast, options) – generates JS code from the AST. By - default it's minified, but using the options argument you can get nicely - formatted output. options is, well, optional :-) and if you pass it it - must be an object and supports the following properties (below you can see - the default values): - -
              -
            • beautify: false – pass true if you want indented output -
            • -
            • indent_start: 0 (only applies when beautify is true) – initial - indentation in spaces -
            • -
            • indent_level: 4 (only applies when beautify is true) -- - indentation level, in spaces (pass an even number) -
            • -
            • quote_keys: false – if you pass true it will quote all keys in - literal objects -
            • -
            • space_colon: false (only applies when beautify is true) – wether - to put a space before the colon in object literals -
            • -
            • ascii_only: false – pass true if you want to encode non-ASCII - characters as \uXXXX. -
            • -
            • inline_script: false – pass true to escape occurrences of - </script in strings -
            • -
            - -
          • -
          - - -
          - -
          - -
          -

          1.4.2 Beautifier shortcoming – no more comments

          -
          - - -

          -The beautifier can be used as a general purpose indentation tool. It's -useful when you want to make a minified file readable. One limitation, -though, is that it discards all comments, so you don't really want to use it -to reformat your code, unless you don't have, or don't care about, comments. -

          -

          -In fact it's not the beautifier who discards comments — they are dumped at -the parsing stage, when we build the initial AST. Comments don't really -make sense in the AST, and while we could add nodes for them, it would be -inconvenient because we'd have to add special rules to ignore them at all -the processing stages. -

          -
          - -
          - -
          -

          1.4.3 Use as a code pre-processor

          -
          - - -

          -The --define option can be used, particularly when combined with the -constant folding logic, as a form of pre-processor to enable or remove -particular constructions, such as might be used for instrumenting -development code, or to produce variations aimed at a specific -platform. -

          -

          -The code below illustrates the way this can be done, and how the -symbol replacement is performed. -

          - - - -
          CLAUSE1: if (typeof DEVMODE === 'undefined') {
          -    DEVMODE = true;
          -}
          -
          -CLAUSE2: function init() {
          -    if (DEVMODE) {
          -        console.log("init() called");
          -    }
          -    ....
          -    DEVMODE &amp;&amp; console.log("init() complete");
          -}
          -
          -CLAUSE3: function reportDeviceStatus(device) {
          -    var DEVMODE = device.mode, DEVNAME = device.name;
          -    if (DEVMODE === 'open') {
          -        ....
          -    }
          -}
          -
          - - -

          -When the above code is normally executed, the undeclared global -variable DEVMODE will be assigned the value true (see CLAUSE1) -and so the init() function (CLAUSE2) will write messages to the -console log when executed, but in CLAUSE3 a locally declared -variable will mask access to the DEVMODE global symbol. -

          -

          -If the above code is processed by UglifyJS with an argument of ---define DEVMODE=false then UglifyJS will replace DEVMODE with the -boolean constant value false within CLAUSE1 and CLAUSE2, but it -will leave CLAUSE3 as it stands because there DEVMODE resolves to -a validly declared variable. -

          -

          -And more so, the constant-folding features of UglifyJS will recognise -that the if condition of CLAUSE1 is thus always false, and so will -remove the test and body of CLAUSE1 altogether (including the -otherwise slightly problematical statement false = true; which it -will have formed by replacing DEVMODE in the body). Similarly, -within CLAUSE2 both calls to console.log() will be removed -altogether. -

          -

          -In this way you can mimic, to a limited degree, the functionality of -the C/C++ pre-processor to enable or completely remove blocks -depending on how certain symbols are defined - perhaps using UglifyJS -to generate different versions of source aimed at different -environments -

          -

          -It is recommmended (but not made mandatory) that symbols designed for -this purpose are given names consisting of UPPER_CASE_LETTERS to -distinguish them from other (normal) symbols and avoid the sort of -clash that CLAUSE3 above illustrates. -

          -
          -
          - -
          - -
          -

          1.5 Compression – how good is it?

          -
          - - -

          -Here are updated statistics. (I also updated my Google Closure and YUI -installations). -

          -

          -We're still a lot better than YUI in terms of compression, though slightly -slower. We're still a lot faster than Closure, and compression after gzip -is comparable. -

          - - -- - - - - - - - - - -
          FileUglifyJSUglifyJS+gzipClosureClosure+gzipYUIYUI+gzip
          jquery-1.6.2.js91001 (0:01.59)3189690678 (0:07.40)31979101527 (0:01.82)34646
          paper.js142023 (0:01.65)43334134301 (0:07.42)42495173383 (0:01.58)48785
          prototype.js88544 (0:01.09)2668086955 (0:06.97)2632692130 (0:00.79)28624
          thelib-full.js (DynarchLIB)251939 (0:02.55)72535249911 (0:09.05)72696258869 (0:01.94)76584
          - - -
          - -
          - -
          -

          1.6 Bugs?

          -
          - - -

          -Unfortunately, for the time being there is no automated test suite. But I -ran the compressor manually on non-trivial code, and then I tested that the -generated code works as expected. A few hundred times. -

          -

          -DynarchLIB was started in times when there was no good JS minifier. -Therefore I was quite religious about trying to write short code manually, -and as such DL contains a lot of syntactic hacks1 such as “foo == bar ? a -= 10 : b = 20”, though the more readable version would clearly be to use -“if/else”. -

          -

          -Since the parser/compressor runs fine on DL and jQuery, I'm quite confident -that it's solid enough for production use. If you can identify any bugs, -I'd love to hear about them (use the Google Group or email me directly). -

          -
          - -
          - -
          -

          1.7 Links

          -
          - - - - - -
          - -
          - -
          -

          1.8 License

          -
          - - -

          -UglifyJS is released under the BSD license: -

          - - - -
          Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com>
          -Based on parse-js (http://marijn.haverbeke.nl/parse-js/).
          -
          -Redistribution and use in source and binary forms, with or without
          -modification, are permitted provided that the following conditions
          -are met:
          -
          -    * Redistributions of source code must retain the above
          -      copyright notice, this list of conditions and the following
          -      disclaimer.
          -
          -    * Redistributions in binary form must reproduce the above
          -      copyright notice, this list of conditions and the following
          -      disclaimer in the documentation and/or other materials
          -      provided with the distribution.
          -
          -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
          -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
          -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
          -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
          -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
          -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
          -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
          -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
          -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
          -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
          -THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
          -SUCH DAMAGE.
          -
          - - -
          -

          Footnotes:

          -
          -

          1 I even reported a few bugs and suggested some fixes in the original - parse-js library, and Marijn pushed fixes literally in minutes. -

          -
          -
          - -
          -
          -
          - -
          -

          Date: 2011-12-09 14:59:08 EET

          -

          Author: Mihai Bazon

          -

          Org version 7.7 with Emacs version 23

          -Validate XHTML 1.0 - -
          - - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/README.org b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/README.org deleted file mode 100644 index 4d01fdfd..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/README.org +++ /dev/null @@ -1,574 +0,0 @@ -#+TITLE: UglifyJS -- a JavaScript parser/compressor/beautifier -#+KEYWORDS: javascript, js, parser, compiler, compressor, mangle, minify, minifier -#+DESCRIPTION: a JavaScript parser/compressor/beautifier in JavaScript -#+STYLE: -#+AUTHOR: Mihai Bazon -#+EMAIL: mihai.bazon@gmail.com - -* UglifyJS --- a JavaScript parser/compressor/beautifier - -This package implements a general-purpose JavaScript -parser/compressor/beautifier toolkit. It is developed on [[http://nodejs.org/][NodeJS]], but it -should work on any JavaScript platform supporting the CommonJS module system -(and if your platform of choice doesn't support CommonJS, you can easily -implement it, or discard the =exports.*= lines from UglifyJS sources). - -The tokenizer/parser generates an abstract syntax tree from JS code. You -can then traverse the AST to learn more about the code, or do various -manipulations on it. This part is implemented in [[../lib/parse-js.js][parse-js.js]] and it's a -port to JavaScript of the excellent [[http://marijn.haverbeke.nl/parse-js/][parse-js]] Common Lisp library from [[http://marijn.haverbeke.nl/][Marijn -Haverbeke]]. - -( See [[http://github.com/mishoo/cl-uglify-js][cl-uglify-js]] if you're looking for the Common Lisp version of -UglifyJS. ) - -The second part of this package, implemented in [[../lib/process.js][process.js]], inspects and -manipulates the AST generated by the parser to provide the following: - -- ability to re-generate JavaScript code from the AST. Optionally - indented---you can use this if you want to “beautify” a program that has - been compressed, so that you can inspect the source. But you can also run - our code generator to print out an AST without any whitespace, so you - achieve compression as well. - -- shorten variable names (usually to single characters). Our mangler will - analyze the code and generate proper variable names, depending on scope - and usage, and is smart enough to deal with globals defined elsewhere, or - with =eval()= calls or =with{}= statements. In short, if =eval()= or - =with{}= are used in some scope, then all variables in that scope and any - variables in the parent scopes will remain unmangled, and any references - to such variables remain unmangled as well. - -- various small optimizations that may lead to faster code but certainly - lead to smaller code. Where possible, we do the following: - - - foo["bar"] ==> foo.bar - - - remove block brackets ={}= - - - join consecutive var declarations: - var a = 10; var b = 20; ==> var a=10,b=20; - - - resolve simple constant expressions: 1 +2 * 3 ==> 7. We only do the - replacement if the result occupies less bytes; for example 1/3 would - translate to 0.333333333333, so in this case we don't replace it. - - - consecutive statements in blocks are merged into a sequence; in many - cases, this leaves blocks with a single statement, so then we can remove - the block brackets. - - - various optimizations for IF statements: - - - if (foo) bar(); else baz(); ==> foo?bar():baz(); - - if (!foo) bar(); else baz(); ==> foo?baz():bar(); - - if (foo) bar(); ==> foo&&bar(); - - if (!foo) bar(); ==> foo||bar(); - - if (foo) return bar(); else return baz(); ==> return foo?bar():baz(); - - if (foo) return bar(); else something(); ==> {if(foo)return bar();something()} - - - remove some unreachable code and warn about it (code that follows a - =return=, =throw=, =break= or =continue= statement, except - function/variable declarations). - - - act a limited version of a pre-processor (c.f. the pre-processor of - C/C++) to allow you to safely replace selected global symbols with - specified values. When combined with the optimisations above this can - make UglifyJS operate slightly more like a compilation process, in - that when certain symbols are replaced by constant values, entire code - blocks may be optimised away as unreachable. - -** <> - -The following transformations can in theory break code, although they're -probably safe in most practical cases. To enable them you need to pass the -=--unsafe= flag. - -*** Calls involving the global Array constructor - -The following transformations occur: - -#+BEGIN_SRC js -new Array(1, 2, 3, 4) => [1,2,3,4] -Array(a, b, c) => [a,b,c] -new Array(5) => Array(5) -new Array(a) => Array(a) -#+END_SRC - -These are all safe if the Array name isn't redefined. JavaScript does allow -one to globally redefine Array (and pretty much everything, in fact) but I -personally don't see why would anyone do that. - -UglifyJS does handle the case where Array is redefined locally, or even -globally but with a =function= or =var= declaration. Therefore, in the -following cases UglifyJS *doesn't touch* calls or instantiations of Array: - -#+BEGIN_SRC js -// case 1. globally declared variable - var Array; - new Array(1, 2, 3); - Array(a, b); - - // or (can be declared later) - new Array(1, 2, 3); - var Array; - - // or (can be a function) - new Array(1, 2, 3); - function Array() { ... } - -// case 2. declared in a function - (function(){ - a = new Array(1, 2, 3); - b = Array(5, 6); - var Array; - })(); - - // or - (function(Array){ - return Array(5, 6, 7); - })(); - - // or - (function(){ - return new Array(1, 2, 3, 4); - function Array() { ... } - })(); - - // etc. -#+END_SRC - -*** =obj.toString()= ==> =obj+“”= - -** Install (NPM) - -UglifyJS is now available through NPM --- =npm install uglify-js= should do -the job. - -** Install latest code from GitHub - -#+BEGIN_SRC sh -## clone the repository -mkdir -p /where/you/wanna/put/it -cd /where/you/wanna/put/it -git clone git://github.com/mishoo/UglifyJS.git - -## make the module available to Node -mkdir -p ~/.node_libraries/ -cd ~/.node_libraries/ -ln -s /where/you/wanna/put/it/UglifyJS/uglify-js.js - -## and if you want the CLI script too: -mkdir -p ~/bin -cd ~/bin -ln -s /where/you/wanna/put/it/UglifyJS/bin/uglifyjs - # (then add ~/bin to your $PATH if it's not there already) -#+END_SRC - -** Usage - -There is a command-line tool that exposes the functionality of this library -for your shell-scripting needs: - -#+BEGIN_SRC sh -uglifyjs [ options... ] [ filename ] -#+END_SRC - -=filename= should be the last argument and should name the file from which -to read the JavaScript code. If you don't specify it, it will read code -from STDIN. - -Supported options: - -- =-b= or =--beautify= --- output indented code; when passed, additional - options control the beautifier: - - - =-i N= or =--indent N= --- indentation level (number of spaces) - - - =-q= or =--quote-keys= --- quote keys in literal objects (by default, - only keys that cannot be identifier names will be quotes). - -- =--ascii= --- pass this argument to encode non-ASCII characters as - =\uXXXX= sequences. By default UglifyJS won't bother to do it and will - output Unicode characters instead. (the output is always encoded in UTF8, - but if you pass this option you'll only get ASCII). - -- =-nm= or =--no-mangle= --- don't mangle names. - -- =-nmf= or =--no-mangle-functions= -- in case you want to mangle variable - names, but not touch function names. - -- =-ns= or =--no-squeeze= --- don't call =ast_squeeze()= (which does various - optimizations that result in smaller, less readable code). - -- =-mt= or =--mangle-toplevel= --- mangle names in the toplevel scope too - (by default we don't do this). - -- =--no-seqs= --- when =ast_squeeze()= is called (thus, unless you pass - =--no-squeeze=) it will reduce consecutive statements in blocks into a - sequence. For example, "a = 10; b = 20; foo();" will be written as - "a=10,b=20,foo();". In various occasions, this allows us to discard the - block brackets (since the block becomes a single statement). This is ON - by default because it seems safe and saves a few hundred bytes on some - libs that I tested it on, but pass =--no-seqs= to disable it. - -- =--no-dead-code= --- by default, UglifyJS will remove code that is - obviously unreachable (code that follows a =return=, =throw=, =break= or - =continue= statement and is not a function/variable declaration). Pass - this option to disable this optimization. - -- =-nc= or =--no-copyright= --- by default, =uglifyjs= will keep the initial - comment tokens in the generated code (assumed to be copyright information - etc.). If you pass this it will discard it. - -- =-o filename= or =--output filename= --- put the result in =filename=. If - this isn't given, the result goes to standard output (or see next one). - -- =--overwrite= --- if the code is read from a file (not from STDIN) and you - pass =--overwrite= then the output will be written in the same file. - -- =--ast= --- pass this if you want to get the Abstract Syntax Tree instead - of JavaScript as output. Useful for debugging or learning more about the - internals. - -- =-v= or =--verbose= --- output some notes on STDERR (for now just how long - each operation takes). - -- =-d SYMBOL[=VALUE]= or =--define SYMBOL[=VALUE]= --- will replace - all instances of the specified symbol where used as an identifier - (except where symbol has properly declared by a var declaration or - use as function parameter or similar) with the specified value. This - argument may be specified multiple times to define multiple - symbols - if no value is specified the symbol will be replaced with - the value =true=, or you can specify a numeric value (such as - =1024=), a quoted string value (such as ="object"= or - ='https://github.com'=), or the name of another symbol or keyword - (such as =null= or =document=). - This allows you, for example, to assign meaningful names to key - constant values but discard the symbolic names in the uglified - version for brevity/efficiency, or when used wth care, allows - UglifyJS to operate as a form of *conditional compilation* - whereby defining appropriate values may, by dint of the constant - folding and dead code removal features above, remove entire - superfluous code blocks (e.g. completely remove instrumentation or - trace code for production use). - Where string values are being defined, the handling of quotes are - likely to be subject to the specifics of your command shell - environment, so you may need to experiment with quoting styles - depending on your platform, or you may find the option - =--define-from-module= more suitable for use. - -- =-define-from-module SOMEMODULE= --- will load the named module (as - per the NodeJS =require()= function) and iterate all the exported - properties of the module defining them as symbol names to be defined - (as if by the =--define= option) per the name of each property - (i.e. without the module name prefix) and given the value of the - property. This is a much easier way to handle and document groups of - symbols to be defined rather than a large number of =--define= - options. - -- =--unsafe= --- enable other additional optimizations that are known to be - unsafe in some contrived situations, but could still be generally useful. - For now only these: - - - foo.toString() ==> foo+"" - - new Array(x,...) ==> [x,...] - - new Array(x) ==> Array(x) - -- =--max-line-len= (default 32K characters) --- add a newline after around - 32K characters. I've seen both FF and Chrome croak when all the code was - on a single line of around 670K. Pass --max-line-len 0 to disable this - safety feature. - -- =--reserved-names= --- some libraries rely on certain names to be used, as - pointed out in issue #92 and #81, so this option allow you to exclude such - names from the mangler. For example, to keep names =require= and =$super= - intact you'd specify --reserved-names "require,$super". - -- =--inline-script= -- when you want to include the output literally in an - HTML = - - - -

          This example will upload an entire directory tree to the node.js server via a fast and persistent WebSocket connection.

          -

          Note that the example is Chrome only for now.

          -

          - Upload status: -
          Please select a directory to upload.
          - - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/public/uploader.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/public/uploader.js deleted file mode 100644 index 0c34a7fa..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/public/uploader.js +++ /dev/null @@ -1,55 +0,0 @@ -function Uploader(url, cb) { - this.ws = new WebSocket(url); - if (cb) this.ws.onopen = cb; - this.sendQueue = []; - this.sending = null; - this.sendCallback = null; - this.ondone = null; - var self = this; - this.ws.onmessage = function(event) { - var data = JSON.parse(event.data); - if (data.event == 'complete') { - if (data.path != self.sending.path) { - self.sendQueue = []; - self.sending = null; - self.sendCallback = null; - throw new Error('Got message for wrong file!'); - } - self.sending = null; - var callback = self.sendCallback; - self.sendCallback = null; - if (callback) callback(); - if (self.sendQueue.length === 0 && self.ondone) self.ondone(null); - if (self.sendQueue.length > 0) { - var args = self.sendQueue.pop(); - setTimeout(function() { self.sendFile.apply(self, args); }, 0); - } - } - else if (data.event == 'error') { - self.sendQueue = []; - self.sending = null; - var callback = self.sendCallback; - self.sendCallback = null; - var error = new Error('Server reported send error for file ' + data.path); - if (callback) callback(error); - if (self.ondone) self.ondone(error); - } - } -} - -Uploader.prototype.sendFile = function(file, cb) { - if (this.ws.readyState != WebSocket.OPEN) throw new Error('Not connected'); - if (this.sending) { - this.sendQueue.push(arguments); - return; - } - var fileData = { name: file.name, path: file.webkitRelativePath }; - this.sending = fileData; - this.sendCallback = cb; - this.ws.send(JSON.stringify(fileData)); - this.ws.send(file); -} - -Uploader.prototype.close = function() { - this.ws.close(); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/server.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/server.js deleted file mode 100644 index badfeba7..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/server.js +++ /dev/null @@ -1,103 +0,0 @@ -var WebSocketServer = require('../../').Server - , express = require('express') - , fs = require('fs') - , http = require('http') - , util = require('util') - , path = require('path') - , app = express.createServer() - , events = require('events') - , ansi = require('ansi') - , cursor = ansi(process.stdout); - -function BandwidthSampler(ws, interval) { - interval = interval || 2000; - var previousByteCount = 0; - var self = this; - var intervalId = setInterval(function() { - var byteCount = ws.bytesReceived; - var bytesPerSec = (byteCount - previousByteCount) / (interval / 1000); - previousByteCount = byteCount; - self.emit('sample', bytesPerSec); - }, interval); - ws.on('close', function() { - clearInterval(intervalId); - }); -} -util.inherits(BandwidthSampler, events.EventEmitter); - -function makePathForFile(filePath, prefix, cb) { - if (typeof cb !== 'function') throw new Error('callback is required'); - filePath = path.dirname(path.normalize(filePath)).replace(/^(\/|\\)+/, ''); - var pieces = filePath.split(/(\\|\/)/); - var incrementalPath = prefix; - function step(error) { - if (error) return cb(error); - if (pieces.length == 0) return cb(null, incrementalPath); - incrementalPath += '/' + pieces.shift(); - fs.exists(incrementalPath, function(exists) { - if (!exists) fs.mkdir(incrementalPath, step); - else process.nextTick(step); - }); - } - step(); -} - -cursor.eraseData(2).goto(1, 1); -app.use(express.static(__dirname + '/public')); - -var clientId = 0; -var wss = new WebSocketServer({server: app}); -wss.on('connection', function(ws) { - var thisId = ++clientId; - cursor.goto(1, 4 + thisId).eraseLine(); - console.log('Client #%d connected', thisId); - - var sampler = new BandwidthSampler(ws); - sampler.on('sample', function(bps) { - cursor.goto(1, 4 + thisId).eraseLine(); - console.log('WebSocket #%d incoming bandwidth: %d MB/s', thisId, Math.round(bps / (1024*1024))); - }); - - var filesReceived = 0; - var currentFile = null; - ws.on('message', function(data, flags) { - if (!flags.binary) { - currentFile = JSON.parse(data); - // note: a real-world app would want to sanity check the data - } - else { - if (currentFile == null) return; - makePathForFile(currentFile.path, __dirname + '/uploaded', function(error, path) { - if (error) { - console.log(error); - ws.send(JSON.stringify({event: 'error', path: currentFile.path, message: error.message})); - return; - } - fs.writeFile(path + '/' + currentFile.name, data, function(error) { - ++filesReceived; - // console.log('received %d bytes long file, %s', data.length, currentFile.path); - ws.send(JSON.stringify({event: 'complete', path: currentFile.path})); - currentFile = null; - }); - }); - } - }); - - ws.on('close', function() { - cursor.goto(1, 4 + thisId).eraseLine(); - console.log('Client #%d disconnected. %d files received.', thisId, filesReceived); - }); - - ws.on('error', function(e) { - cursor.goto(1, 4 + thisId).eraseLine(); - console.log('Client #%d error: %s', thisId, e.message); - }); -}); - -fs.mkdir(__dirname + '/uploaded', function(error) { - // ignore errors, most likely means directory exists - console.log('Uploaded files will be saved to %s/uploaded.', __dirname); - console.log('Remember to wipe this directory if you upload lots and lots.'); - app.listen(8080); - console.log('Listening on http://localhost:8080'); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/package.json deleted file mode 100644 index 99722c42..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "author": "", - "name": "serverstats", - "version": "0.0.0", - "repository": { - "type": "git", - "url": "git://github.com/einaros/ws.git" - }, - "engines": { - "node": ">0.4.0" - }, - "dependencies": { - "express": "~3.0.0" - }, - "devDependencies": {}, - "optionalDependencies": {} -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/public/index.html b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/public/index.html deleted file mode 100644 index 24d84e12..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/public/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - Server Stats
          - RSS:

          - Heap total:

          - Heap used:

          - - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/server.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/server.js deleted file mode 100644 index 92501192..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/server.js +++ /dev/null @@ -1,21 +0,0 @@ -var WebSocketServer = require('../../').Server - , http = require('http') - , express = require('express') - , app = express(); - -app.use(express.static(__dirname + '/public')); - -var server = http.createServer(app); -server.listen(8080); - -var wss = new WebSocketServer({server: server}); -wss.on('connection', function(ws) { - var id = setInterval(function() { - ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ }); - }, 100); - console.log('started client interval'); - ws.on('close', function() { - console.log('stopping client interval'); - clearInterval(id); - }) -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/package.json deleted file mode 100644 index 65c900ab..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "author": "", - "name": "serverstats", - "version": "0.0.0", - "repository": { - "type": "git", - "url": "git://github.com/einaros/ws.git" - }, - "engines": { - "node": ">0.4.0" - }, - "dependencies": { - "express": "2.x" - }, - "devDependencies": {}, - "optionalDependencies": {} -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/public/index.html b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/public/index.html deleted file mode 100644 index 24d84e12..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/public/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - Server Stats
          - RSS:

          - Heap total:

          - Heap used:

          - - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/server.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/server.js deleted file mode 100644 index 0bbce368..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/server.js +++ /dev/null @@ -1,19 +0,0 @@ -var WebSocketServer = require('../../').Server - , http = require('http') - , express = require('express') - , app = express.createServer(); - -app.use(express.static(__dirname + '/public')); -app.listen(8080); - -var wss = new WebSocketServer({server: app}); -wss.on('connection', function(ws) { - var id = setInterval(function() { - ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ }); - }, 100); - console.log('started client interval'); - ws.on('close', function() { - console.log('stopping client interval'); - clearInterval(id); - }) -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js deleted file mode 100644 index 3423ff23..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports = require('./lib/WebSocket'); -module.exports.Server = require('./lib/WebSocketServer'); -module.exports.Sender = require('./lib/Sender'); -module.exports.Receiver = require('./lib/Receiver'); - -module.exports.createServer = function (options, connectionListener) { - var server = new module.exports.Server(options); - if (typeof connectionListener === 'function') { - server.on('connection', connectionListener); - } - return server; -}; - -module.exports.connect = module.exports.createConnection = function (address, openListener) { - var client = new module.exports(address); - if (typeof openListener === 'function') { - client.on('open', openListener); - } - return client; -}; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js deleted file mode 100644 index faf8637c..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js +++ /dev/null @@ -1,59 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util'); - -function BufferPool(initialSize, growStrategy, shrinkStrategy) { - if (typeof initialSize === 'function') { - shrinkStrategy = growStrategy; - growStrategy = initialSize; - initialSize = 0; - } - else if (typeof initialSize === 'undefined') { - initialSize = 0; - } - this._growStrategy = (growStrategy || function(db, size) { - return db.used + size; - }).bind(null, this); - this._shrinkStrategy = (shrinkStrategy || function(db) { - return initialSize; - }).bind(null, this); - this._buffer = initialSize ? new Buffer(initialSize) : null; - this._offset = 0; - this._used = 0; - this._changeFactor = 0; - this.__defineGetter__('size', function(){ - return this._buffer == null ? 0 : this._buffer.length; - }); - this.__defineGetter__('used', function(){ - return this._used; - }); -} - -BufferPool.prototype.get = function(length) { - if (this._buffer == null || this._offset + length > this._buffer.length) { - var newBuf = new Buffer(this._growStrategy(length)); - this._buffer = newBuf; - this._offset = 0; - } - this._used += length; - var buf = this._buffer.slice(this._offset, this._offset + length); - this._offset += length; - return buf; -} - -BufferPool.prototype.reset = function(forceNewBuffer) { - var len = this._shrinkStrategy(); - if (len < this.size) this._changeFactor -= 1; - if (forceNewBuffer || this._changeFactor < -2) { - this._changeFactor = 0; - this._buffer = len ? new Buffer(len) : null; - } - this._offset = 0; - this._used = 0; -} - -module.exports = BufferPool; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js deleted file mode 100644 index 508542c9..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports.BufferUtil = { - merge: function(mergedBuffer, buffers) { - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - var buf = buffers[i]; - buf.copy(mergedBuffer, offset); - offset += buf.length; - } - }, - mask: function(source, mask, output, offset, length) { - var maskNum = mask.readUInt32LE(0, true); - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ source.readUInt32LE(i, true); - if (num < 0) num = 4294967296 + num; - output.writeUInt32LE(num, offset + i, true); - } - switch (length % 4) { - case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; - case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; - case 1: output[offset + i] = source[i] ^ mask[0]; - case 0:; - } - }, - unmask: function(data, mask) { - var maskNum = mask.readUInt32LE(0, true); - var length = data.length; - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ data.readUInt32LE(i, true); - if (num < 0) num = 4294967296 + num; - data.writeUInt32LE(num, i, true); - } - switch (length % 4) { - case 3: data[i + 2] = data[i + 2] ^ mask[2]; - case 2: data[i + 1] = data[i + 1] ^ mask[1]; - case 1: data[i] = data[i] ^ mask[0]; - case 0:; - } - } -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js deleted file mode 100644 index 15d35b98..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -try { - module.exports = require('../build/Release/bufferutil'); -} catch (e) { try { - module.exports = require('../build/default/bufferutil'); -} catch (e) { try { - module.exports = require('./BufferUtil.fallback'); -} catch (e) { - console.error('bufferutil.node seems to not have been built. Run npm install.'); - throw e; -}}} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js deleted file mode 100644 index 55ebd529..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js +++ /dev/null @@ -1,24 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports = { - isValidErrorCode: function(code) { - return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || - (code >= 3000 && code <= 4999); - }, - 1000: 'normal', - 1001: 'going away', - 1002: 'protocol error', - 1003: 'unsupported data', - 1004: 'reserved', - 1005: 'reserved for extensions', - 1006: 'reserved for extensions', - 1007: 'inconsistent or invalid data', - 1008: 'policy violation', - 1009: 'message too big', - 1010: 'extension handshake missing', - 1011: 'an unexpected condition prevented the request from being fulfilled', -}; \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js deleted file mode 100644 index f54ad966..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js +++ /dev/null @@ -1,180 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util'); - -/** - * State constants - */ - -var EMPTY = 0 - , BODY = 1; -var BINARYLENGTH = 2 - , BINARYBODY = 3; - -/** - * Hixie Receiver implementation - */ - -function Receiver () { - this.state = EMPTY; - this.buffers = []; - this.messageEnd = -1; - this.spanLength = 0; - this.dead = false; - - this.onerror = function() {}; - this.ontext = function() {}; - this.onbinary = function() {}; - this.onclose = function() {}; - this.onping = function() {}; - this.onpong = function() {}; -} - -module.exports = Receiver; - -/** - * Add new data to the parser. - * - * @api public - */ - -Receiver.prototype.add = function(data) { - var self = this; - function doAdd() { - if (self.state === EMPTY) { - if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { - self.reset(); - self.onclose(); - return; - } - if (data[0] === 0x80) { - self.messageEnd = 0; - self.state = BINARYLENGTH; - data = data.slice(1); - } else { - - if (data[0] !== 0x00) { - self.error('payload must start with 0x00 byte', true); - return; - } - data = data.slice(1); - self.state = BODY; - - } - } - if (self.state === BINARYLENGTH) { - var i = 0; - while ((i < data.length) && (data[i] & 0x80)) { - self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); - ++i; - } - if (i < data.length) { - self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); - self.state = BINARYBODY; - ++i; - } - if (i > 0) - data = data.slice(i); - } - if (self.state === BINARYBODY) { - var dataleft = self.messageEnd - self.spanLength; - if (data.length >= dataleft) { - // consume the whole buffer to finish the frame - self.buffers.push(data); - self.spanLength += dataleft; - self.messageEnd = dataleft; - return self.parse(); - } - // frame's not done even if we consume it all - self.buffers.push(data); - self.spanLength += data.length; - return; - } - self.buffers.push(data); - if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { - self.spanLength += self.messageEnd; - return self.parse(); - } - else self.spanLength += data.length; - } - while(data) data = doAdd(); -} - -/** - * Releases all resources used by the receiver. - * - * @api public - */ - -Receiver.prototype.cleanup = function() { - this.dead = true; - this.state = EMPTY; - this.buffers = []; -} - -/** - * Process buffered data. - * - * @api public - */ - -Receiver.prototype.parse = function() { - var output = new Buffer(this.spanLength); - var outputIndex = 0; - for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { - var buffer = this.buffers[bi]; - buffer.copy(output, outputIndex); - outputIndex += buffer.length; - } - var lastBuffer = this.buffers[this.buffers.length - 1]; - if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); - if (this.state !== BODY) --this.messageEnd; - var tail = null; - if (this.messageEnd < lastBuffer.length - 1) { - tail = lastBuffer.slice(this.messageEnd + 1); - } - this.reset(); - this.ontext(output.toString('utf8')); - return tail; -} - -/** - * Handles an error - * - * @api private - */ - -Receiver.prototype.error = function (reason, terminate) { - this.reset(); - this.onerror(reason, terminate); - return this; -} - -/** - * Reset parser state - * - * @api private - */ - -Receiver.prototype.reset = function (reason) { - if (this.dead) return; - this.state = EMPTY; - this.buffers = []; - this.messageEnd = -1; - this.spanLength = 0; -} - -/** - * Internal api - */ - -function bufferIndex(buffer, byte) { - for (var i = 0, l = buffer.length; i < l; ++i) { - if (buffer[i] === byte) return i; - } - return -1; -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js deleted file mode 100644 index 2752726f..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js +++ /dev/null @@ -1,591 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util') - , Validation = require('./Validation').Validation - , ErrorCodes = require('./ErrorCodes') - , BufferPool = require('./BufferPool') - , bufferUtil = require('./BufferUtil').BufferUtil; - -/** - * Node version 0.4 and 0.6 compatibility - */ - -var isNodeV4 = /^v0\.4/.test(process.version); - -/** - * HyBi Receiver implementation - */ - -function Receiver () { - // memory pool for fragmented messages - var fragmentedPoolPrevUsed = -1; - this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { - return db.used + length; - }, function(db) { - return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? - (fragmentedPoolPrevUsed + db.used) / 2 : - db.used; - }); - - // memory pool for unfragmented messages - var unfragmentedPoolPrevUsed = -1; - this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { - return db.used + length; - }, function(db) { - return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? - (unfragmentedPoolPrevUsed + db.used) / 2 : - db.used; - }); - - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0, - fragmentedOperation: false - }; - this.overflow = []; - this.headerBuffer = new Buffer(10); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = []; - this.expectHeader(2, this.processPacket); - this.dead = false; - - this.onerror = function() {}; - this.ontext = function() {}; - this.onbinary = function() {}; - this.onclose = function() {}; - this.onping = function() {}; - this.onpong = function() {}; -}; - -module.exports = Receiver; - -/** - * Add new data to the parser. - * - * @api public - */ - -Receiver.prototype.add = function(data) { - var dataLength = data.length; - if (dataLength == 0) return; - if (this.expectBuffer == null) { - this.overflow.push(data); - return; - } - var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); - fastCopy(toRead, data, this.expectBuffer, this.expectOffset); - this.expectOffset += toRead; - if (toRead < dataLength) { - this.overflow.push(data.slice(toRead)); - } - while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } -} - -/** - * Releases all resources used by the receiver. - * - * @api public - */ - -Receiver.prototype.cleanup = function() { - this.dead = true; - this.overflow = null; - this.headerBuffer = null; - this.expectBuffer = null; - this.expectHandler = null; - this.unfragmentedBufferPool = null; - this.fragmentedBufferPool = null; - this.state = null; - this.currentMessage = null; - this.onerror = null; - this.ontext = null; - this.onbinary = null; - this.onclose = null; - this.onping = null; - this.onpong = null; -} - -/** - * Waits for a certain amount of header bytes to be available, then fires a callback. - * - * @api private - */ - -Receiver.prototype.expectHeader = function(length, handler) { - if (length == 0) { - handler(null); - return; - } - this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); - this.expectHandler = handler; - var toRead = length; - while (toRead > 0 && this.overflow.length > 0) { - var fromOverflow = this.overflow.pop(); - if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); - var read = Math.min(fromOverflow.length, toRead); - fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); - this.expectOffset += read; - toRead -= read; - } -} - -/** - * Waits for a certain amount of data bytes to be available, then fires a callback. - * - * @api private - */ - -Receiver.prototype.expectData = function(length, handler) { - if (length == 0) { - handler(null); - return; - } - this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); - this.expectHandler = handler; - var toRead = length; - while (toRead > 0 && this.overflow.length > 0) { - var fromOverflow = this.overflow.pop(); - if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); - var read = Math.min(fromOverflow.length, toRead); - fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); - this.expectOffset += read; - toRead -= read; - } -} - -/** - * Allocates memory from the buffer pool. - * - * @api private - */ - -Receiver.prototype.allocateFromPool = !isNodeV4 - ? function(length, isFragmented) { return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); } - : function(length) { return new Buffer(length); }; - -/** - * Start processing a new packet. - * - * @api private - */ - -Receiver.prototype.processPacket = function (data) { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty', 1002); - return; - } - this.state.lastFragment = (data[0] & 0x80) == 0x80; - this.state.masked = (data[1] & 0x80) == 0x80; - var opcode = data[0] & 0xf; - if (opcode === 0) { - // continuation frame - this.state.fragmentedOperation = true; - this.state.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode', 1002); - return; - } - } - else { - if (opcode < 3 && this.state.activeFragmentedOperation != null) { - this.error('data frames after the initial data frame must have opcode 0', 1002); - return; - } - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.fragmentedOperation = true; - this.state.activeFragmentedOperation = opcode; - } - else this.state.fragmentedOperation = false; - } - var handler = opcodes[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); - else { - handler.start.call(this, data); - } -} - -/** - * Endprocessing a packet. - * - * @api private - */ - -Receiver.prototype.endPacket = function() { - if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); - else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { - // end current fragmented operation - this.state.activeFragmentedOperation = null; - } - this.state.lastFragment = false; - this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; - this.state.masked = false; - this.expectHeader(2, this.processPacket); -} - -/** - * Reset the parser state. - * - * @api private - */ - -Receiver.prototype.reset = function() { - if (this.dead) return; - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0, - fragmentedOperation: false - }; - this.fragmentedBufferPool.reset(true); - this.unfragmentedBufferPool.reset(true); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = []; - this.currentMessage = []; -} - -/** - * Unmask received data. - * - * @api private - */ - -Receiver.prototype.unmask = function (mask, buf, binary) { - if (mask != null && buf != null) bufferUtil.unmask(buf, mask); - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; -} - -/** - * Concatenates a list of buffers. - * - * @api private - */ - -Receiver.prototype.concatBuffers = function(buffers) { - var length = 0; - for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length; - var mergedBuffer = new Buffer(length); - bufferUtil.merge(mergedBuffer, buffers); - return mergedBuffer; -} - -/** - * Handles an error - * - * @api private - */ - -Receiver.prototype.error = function (reason, protocolErrorCode) { - this.reset(); - this.onerror(reason, protocolErrorCode); - return this; -} - -/** - * Buffer utilities - */ - -function readUInt16BE(start) { - return (this[start]<<8) + - this[start+1]; -} - -function readUInt32BE(start) { - return (this[start]<<24) + - (this[start+1]<<16) + - (this[start+2]<<8) + - this[start+3]; -} - -function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { - switch (length) { - default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; - case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; - case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; - case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; - case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; - case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; - case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; - case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; - case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; - case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; - case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; - case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; - case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; - case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; - case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; - case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; - case 1: dstBuffer[dstOffset] = srcBuffer[0]; - } -} - -/** - * Opcode handlers - */ - -var opcodes = { - // text - '1': { - start: function(data) { - var self = this; - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['1'].getData.call(self, firstLength); - } - else if (firstLength == 126) { - self.expectHeader(2, function(data) { - opcodes['1'].getData.call(self, readUInt16BE.call(data, 0)); - }); - } - else if (firstLength == 127) { - self.expectHeader(8, function(data) { - if (readUInt32BE.call(data, 0) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported', 1008); - return; - } - opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); - }); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['1'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['1'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var packet = this.unmask(mask, data, true); - if (packet != null) this.currentMessage.push(packet); - if (this.state.lastFragment) { - var messageBuffer = this.concatBuffers(this.currentMessage); - if (!Validation.isValidUTF8(messageBuffer)) { - this.error('invalid utf8 sequence', 1007); - return; - } - this.ontext(messageBuffer.toString('utf8'), {masked: this.state.masked, buffer: messageBuffer}); - this.currentMessage = []; - } - this.endPacket(); - } - }, - // binary - '2': { - start: function(data) { - var self = this; - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['2'].getData.call(self, firstLength); - } - else if (firstLength == 126) { - self.expectHeader(2, function(data) { - opcodes['2'].getData.call(self, readUInt16BE.call(data, 0)); - }); - } - else if (firstLength == 127) { - self.expectHeader(8, function(data) { - if (readUInt32BE.call(data, 0) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported', 1008); - return; - } - opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true)); - }); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['2'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['2'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var packet = this.unmask(mask, data, true); - if (packet != null) this.currentMessage.push(packet); - if (this.state.lastFragment) { - var messageBuffer = this.concatBuffers(this.currentMessage); - this.onbinary(messageBuffer, {masked: this.state.masked, buffer: messageBuffer}); - this.currentMessage = []; - } - this.endPacket(); - } - }, - // close - '8': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented close is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['8'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['8'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['8'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - data = self.unmask(mask, data, true); - if (data && data.length == 1) { - self.error('close packets with data must be at least two bytes long', 1002); - return; - } - var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; - if (!ErrorCodes.isValidErrorCode(code)) { - self.error('invalid error code', 1002); - return; - } - var message = ''; - if (data && data.length > 2) { - var messageBuffer = data.slice(2); - if (!Validation.isValidUTF8(messageBuffer)) { - self.error('invalid utf8 sequence', 1007); - return; - } - message = messageBuffer.toString('utf8'); - } - this.onclose(code, message, {masked: self.state.masked}); - this.reset(); - }, - }, - // ping - '9': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['9'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['9'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['9'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - this.onping(this.unmask(mask, data, true), {masked: this.state.masked, binary: true}); - this.endPacket(); - } - }, - // pong - '10': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented pong is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['10'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (this.state.masked) { - this.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['10'].finish.call(self, mask, data); - }); - }); - } - else { - this.expectData(length, function(data) { - opcodes['10'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - this.onpong(this.unmask(mask, data, true), {masked: this.state.masked, binary: true}); - this.endPacket(); - } - } -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js deleted file mode 100644 index 1754afb6..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js +++ /dev/null @@ -1,123 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var events = require('events') - , util = require('util') - , EventEmitter = events.EventEmitter; - -/** - * Hixie Sender implementation - */ - -function Sender(socket) { - this.socket = socket; - this.continuationFrame = false; - this.isClosed = false; -} - -module.exports = Sender; - -/** - * Inherits from EventEmitter. - */ - -util.inherits(Sender, events.EventEmitter); - -/** - * Frames and writes data. - * - * @api public - */ - -Sender.prototype.send = function(data, options, cb) { - if (this.isClosed) return; -/* - if (options && options.binary) { - this.error('hixie websockets do not support binary'); - return; - } -*/ - var isString = typeof data == 'string' - , length = isString ? Buffer.byteLength(data) : data.length - , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes - , writeStartMarker = this.continuationFrame == false - , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) - , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) - , offset = writeStartMarker ? 1 : 0; - - if (writeStartMarker) { - if (options && options.binary) { - buffer.write('\x80', 'binary'); - // assume length less than 2**14 bytes - if (lengthbytes > 1) - buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); - buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); - } else - buffer.write('\x00', 'binary'); - } - - if (isString) buffer.write(data, offset, 'utf8'); - else data.copy(buffer, offset, 0); - - if (writeEndMarker) { - if (options && options.binary) { - // sending binary, not writing end marker - } else - buffer.write('\xff', offset + length, 'binary'); - this.continuationFrame = false; - } - else this.continuationFrame = true; - - try { - this.socket.write(buffer, 'binary', cb); - } catch (e) { - this.error(e.toString()); - } -} - -/** - * Sends a close instruction to the remote party. - * - * @api public - */ - -Sender.prototype.close = function(code, data, mask, cb) { - if (this.isClosed) return; - this.isClosed = true; - try { - if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); - this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); - } catch (e) { - this.error(e.toString()); - } -} - -/** - * Sends a ping message to the remote party. Not available for hixie. - * - * @api public - */ - -Sender.prototype.ping = function(data, options) {} - -/** - * Sends a pong message to the remote party. Not available for hixie. - * - * @api public - */ - -Sender.prototype.pong = function(data, options) {} - -/** - * Handles an error - * - * @api private - */ - -Sender.prototype.error = function (reason) { - this.emit('error', reason); - return this; -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js deleted file mode 100644 index 6e82bc69..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js +++ /dev/null @@ -1,220 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var events = require('events') - , util = require('util') - , EventEmitter = events.EventEmitter - , ErrorCodes = require('./ErrorCodes') - , bufferUtil = require('./BufferUtil').BufferUtil; - -/** - * HyBi Sender implementation - */ - -function Sender(socket) { - this._socket = socket; - this.firstFragment = true; -} - -/** - * Inherits from EventEmitter. - */ - -util.inherits(Sender, events.EventEmitter); - -/** - * Sends a close instruction to the remote party. - * - * @api public - */ - -Sender.prototype.close = function(code, data, mask) { - if (typeof code !== 'undefined') { - if (typeof code !== 'number' || - !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); - } - code = code || 1000; - var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); - writeUInt16BE.call(dataBuffer, code, 0); - if (dataBuffer.length > 2) dataBuffer.write(data, 2); - this.frameAndSend(0x8, dataBuffer, true, mask); -} - -/** - * Sends a ping message to the remote party. - * - * @api public - */ - -Sender.prototype.ping = function(data, options) { - var mask = options && options.mask; - this.frameAndSend(0x9, data || '', true, mask); -} - -/** - * Sends a pong message to the remote party. - * - * @api public - */ - -Sender.prototype.pong = function(data, options) { - var mask = options && options.mask; - this.frameAndSend(0xa, data || '', true, mask); -} - -/** - * Sends text or binary data to the remote party. - * - * @api public - */ - -Sender.prototype.send = function(data, options, cb) { - var finalFragment = options && options.fin === false ? false : true; - var mask = options && options.mask; - var opcode = options && options.binary ? 2 : 1; - if (this.firstFragment === false) opcode = 0; - else this.firstFragment = false; - if (finalFragment) this.firstFragment = true - this.frameAndSend(opcode, data, finalFragment, mask, cb); -} - -/** - * Frames and sends a piece of data according to the HyBi WebSocket protocol. - * - * @api private - */ - -Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, cb) { - var canModifyData = false; - - if (!data) { - try { - this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - return; - } - - if (!Buffer.isBuffer(data)) { - canModifyData = true; - data = (data && typeof data.buffer !== 'undefined') ? getArrayBuffer(data.buffer) : new Buffer(data); - } - - var dataLength = data.length - , dataOffset = maskData ? 6 : 2 - , secondByte = dataLength; - - if (dataLength >= 65536) { - dataOffset += 8; - secondByte = 127; - } - else if (dataLength > 125) { - dataOffset += 2; - secondByte = 126; - } - - var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); - var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; - var outputBuffer = new Buffer(totalLength); - outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; - - switch (secondByte) { - case 126: - writeUInt16BE.call(outputBuffer, dataLength, 2); - break; - case 127: - writeUInt32BE.call(outputBuffer, 0, 2); - writeUInt32BE.call(outputBuffer, dataLength, 6); - } - - if (maskData) { - outputBuffer[1] = secondByte | 0x80; - var mask = this._randomMask || (this._randomMask = getRandomMask()); - outputBuffer[dataOffset - 4] = mask[0]; - outputBuffer[dataOffset - 3] = mask[1]; - outputBuffer[dataOffset - 2] = mask[2]; - outputBuffer[dataOffset - 1] = mask[3]; - if (mergeBuffers) { - bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); - try { - this._socket.write(outputBuffer, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - else { - bufferUtil.mask(data, mask, data, 0, dataLength); - try { - this._socket.write(outputBuffer, 'binary'); - this._socket.write(data, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - } - else { - outputBuffer[1] = secondByte; - if (mergeBuffers) { - data.copy(outputBuffer, dataOffset); - try { - this._socket.write(outputBuffer, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - else { - try { - this._socket.write(outputBuffer, 'binary'); - this._socket.write(data, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - } -} - -module.exports = Sender; - -function writeUInt16BE(value, offset) { - this[offset] = (value & 0xff00)>>8; - this[offset+1] = value & 0xff; -} - -function writeUInt32BE(value, offset) { - this[offset] = (value & 0xff000000)>>24; - this[offset+1] = (value & 0xff0000)>>16; - this[offset+2] = (value & 0xff00)>>8; - this[offset+3] = value & 0xff; -} - -function getArrayBuffer(array) { - var l = array.byteLength - , buffer = new Buffer(l); - for (var i = 0; i < l; ++i) { - buffer[i] = array[i]; - } - return buffer; -} - -function getRandomMask() { - return new Buffer([ - ~~(Math.random() * 255), - ~~(Math.random() * 255), - ~~(Math.random() * 255), - ~~(Math.random() * 255) - ]); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js deleted file mode 100644 index 2c7c4fd4..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js +++ /dev/null @@ -1,12 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports.Validation = { - isValidUTF8: function(buffer) { - return true; - } -}; - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js deleted file mode 100644 index 0f3109a0..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -try { - module.exports = require('../build/Release/validation'); -} catch (e) { try { - module.exports = require('../build/default/validation'); -} catch (e) { try { - module.exports = require('./Validation.fallback'); -} catch (e) { - console.error('validation.node seems to not have been built. Run npm install.'); - throw e; -}}} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js deleted file mode 100644 index 70de62f3..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js +++ /dev/null @@ -1,662 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util') - , events = require('events') - , http = require('http') - , https = require('https') - , crypto = require('crypto') - , url = require('url') - , fs = require('fs') - , Options = require('options') - , Sender = require('./Sender') - , Receiver = require('./Receiver') - , SenderHixie = require('./Sender.hixie') - , ReceiverHixie = require('./Receiver.hixie'); - -/** - * Constants - */ - -// Default protocol version - -var protocolVersion = 13; - -// Close timeout - -var closeTimeout = 30000; // Allow 5 seconds to terminate the connection cleanly - -/** - * Node version 0.4 and 0.6 compatibility - */ - -var isNodeV4 = /^v0\.4/.test(process.version); - -/** - * WebSocket implementation - */ - -function WebSocket(address, options) { - var self = this; - - this._socket = null; - this.bytesReceived = 0; - this.readyState = null; - this.supports = {}; - - if (Object.prototype.toString.call(address) == '[object Array]') { - initAsServerClient.apply(this, address.concat(options)); - } - else initAsClient.apply(this, arguments); -} - -/** - * Inherits from EventEmitter. - */ - -util.inherits(WebSocket, events.EventEmitter); - -/** - * Ready States - */ - -WebSocket.CONNECTING = 0; -WebSocket.OPEN = 1; -WebSocket.CLOSING = 2; -WebSocket.CLOSED = 3; - -/** - * Gracefully closes the connection, after sending a description message to the server - * - * @param {Object} data to be sent to the server - * @api public - */ - -WebSocket.prototype.close = function(code, data) { - if (this.readyState == WebSocket.CLOSING || this.readyState == WebSocket.CLOSED) return; - if (this.readyState == WebSocket.CONNECTING) { - this.readyState = WebSocket.CLOSED; - return; - } - try { - this.readyState = WebSocket.CLOSING; - this._closeCode = code; - this._closeMessage = data; - var mask = !this._isServer; - this._sender.close(code, data, mask); - } - catch (e) { - this.emit('error', e); - } - finally { - this.terminate(); - } -} - -/** - * Pause the client stream - * - * @api public - */ - -WebSocket.prototype.pause = function() { - if (this.readyState != WebSocket.OPEN) throw new Error('not opened'); - return this._socket.pause(); -} - -/** - * Sends a ping - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open - * @api public - */ - -WebSocket.prototype.ping = function(data, options, dontFailWhenClosed) { - if (this.readyState != WebSocket.OPEN) { - if (dontFailWhenClosed === true) return; - throw new Error('not opened'); - } - options = options || {}; - if (typeof options.mask == 'undefined') options.mask = !this._isServer; - this._sender.ping(data, options); -} - -/** - * Sends a pong - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open - * @api public - */ - -WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { - if (this.readyState != WebSocket.OPEN) { - if (dontFailWhenClosed === true) return; - throw new Error('not opened'); - } - options = options || {}; - if (typeof options.mask == 'undefined') options.mask = !this._isServer; - this._sender.pong(data, options); -} - -/** - * Resume the client stream - * - * @api public - */ - -WebSocket.prototype.resume = function() { - if (this.readyState != WebSocket.OPEN) throw new Error('not opened'); - return this._socket.resume(); -} - -/** - * Sends a piece of data - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {function} Optional callback which is executed after the send completes - * @api public - */ - -WebSocket.prototype.send = function(data, options, cb) { - if (typeof options == 'function') { - cb = options; - options = {}; - } - if (this.readyState != WebSocket.OPEN) { - if (typeof cb == 'function') cb(new Error('not opened')); - else throw new Error('not opened'); - return; - } - if (!data) data = ''; - if (this._queue) { - var self = this; - this._queue.push(function() { self.send(data, options, cb); }); - return; - } - options = options || {}; - options.fin = true; - if (typeof options.mask == 'undefined') options.mask = !this._isServer; - if (data instanceof fs.ReadStream) { - startQueue(this); - var self = this; - sendStream(this, data, options, function(error) { - process.nextTick(function() { executeQueueSends(self); }); - if (typeof cb == 'function') cb(error); - }); - } - else this._sender.send(data, options, cb); -} - -/** - * Streams data through calls to a user supplied function - * - * @param {Object} Members - mask: boolean, binary: boolean - * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. - * @api public - */ - -WebSocket.prototype.stream = function(options, cb) { - if (typeof options == 'function') { - cb = options; - options = {}; - } - if (typeof cb != 'function') throw new Error('callback must be provided'); - if (this.readyState != WebSocket.OPEN) { - if (typeof cb == 'function') cb(new Error('not opened')); - else throw new Error('not opened'); - return; - } - if (this._queue) { - var self = this; - this._queue.push(function() { self.stream(options, cb); }); - return; - } - options = options || {}; - if (typeof options.mask == 'undefined') options.mask = !this._isServer; - startQueue(this); - var self = this; - var send = function(data, final) { - try { - if (self.readyState != WebSocket.OPEN) throw new Error('not opened'); - options.fin = final === true; - self._sender.send(data, options); - if (!final) process.nextTick(cb.bind(null, null, send)); - else executeQueueSends(self); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else { - delete self._queue; - self.emit('error', e); - } - } - } - process.nextTick(cb.bind(null, null, send)); -} - -/** - * Immediately shuts down the connection - * - * @api public - */ - -WebSocket.prototype.terminate = function() { - if (this.readyState == WebSocket.CLOSED) return; - if (this._socket) { - try { - // End the connection - this._socket.end(); - } - catch (e) { - // Socket error during end() call, so just destroy it right now - cleanupWebsocketResources.call(this, true); - return; - } - - // Add a timeout to ensure that the connection is completely - // cleaned up within 30 seconds, even if the clean close procedure - // fails for whatever reason - this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); - } - else if (this.readyState == WebSocket.CONNECTING) { - cleanupWebsocketResources.call(this, true); - } -}; - -/** - * Emulates the W3C Browser based WebSocket interface using function members. - * - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ - -['open', 'error', 'close', 'message'].forEach(function(method) { - Object.defineProperty(WebSocket.prototype, 'on' + method, { - /** - * Returns the current listener - * - * @returns {Mixed} the set function or undefined - * @api public - */ - - get: function get() { - var listener = this.listeners(method)[0]; - return listener ? (listener._listener ? listener._listener : listener) : undefined; - }, - - /** - * Start listening for events - * - * @param {Function} listener the listener - * @returns {Mixed} the set function or undefined - * @api public - */ - - set: function set(listener) { - this.removeAllListeners(method); - this.addEventListener(method, listener); - } - }); -}); - -/** - * Emulates the W3C Browser based WebSocket interface using addEventListener. - * - * @see https://developer.mozilla.org/en/DOM/element.addEventListener - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ -WebSocket.prototype.addEventListener = function(method, listener) { - if (typeof listener === 'function') { - if (method === 'message') { - function onMessage (data) { - listener.call(this, new MessageEvent(data)); - } - // store a reference so we can return the original function from the addEventListener hook - onMessage._listener = listener; - this.on(method, onMessage); - } - else if (method === 'close') { - function onClose (code, message) { - listener.call(this, new CloseEvent(code, message)); - } - // store a reference so we can return the original function from the addEventListener hook - onClose._listener = listener; - this.on(method, onClose); - } else { - this.on(method, listener); - } - } -} - -module.exports = WebSocket; - -/** - * W3C MessageEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @api private - */ - -function MessageEvent(dataArg) { - // Currently only the data attribute is implemented. More can be added later if needed. - this.data = dataArg; -} - -/** - * W3C CloseEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @api private - */ - -function CloseEvent(code, reason) { - this.wasClean = (typeof code == 'undefined' || code == 1000); - this.code = code; - this.reason = reason; -} - -/** - * Entirely private apis, - * which may or may not be bound to a sepcific WebSocket instance. - */ - - function initAsServerClient(req, socket, upgradeHead, options) { - options = new Options({ - protocolVersion: protocolVersion, - protocol: null - }).merge(options); - - // expose state properties - this.protocol = options.value.protocol; - this.protocolVersion = options.value.protocolVersion; - this.supports.binary = (this.protocolVersion != 'hixie-76'); - this.upgradeReq = req; - this.readyState = WebSocket.CONNECTING; - this._isServer = true; - - // establish connection - if (options.value.protocolVersion == 'hixie-76') establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); - else establishConnection.call(this, Receiver, Sender, socket, upgradeHead); -} - -function initAsClient(address, options) { - options = new Options({ - origin: null, - protocolVersion: protocolVersion, - host: null, - protocol: null - }).merge(options); - if (options.value.protocolVersion != 8 && options.value.protocolVersion != 13) { - throw new Error('unsupported protocol version'); - } - - // verify url and establish http class - var serverUrl = url.parse(address); - var isUnixSocket = serverUrl.protocol === 'ws+unix:'; - if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); - var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; - var httpObj = isSecure ? https : http; - - // expose state properties - this._isServer = false; - this.url = address; - this.protocolVersion = options.value.protocolVersion; - this.supports.binary = (this.protocolVersion != 'hixie-76'); - - // begin handshake - var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); - var shasum = crypto.createHash('sha1'); - shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); - var expectedServerKey = shasum.digest('base64'); - - // node<=v0.4.x compatibility - var agent; - if (isNodeV4) { - isNodeV4 = true; - agent = new httpObj.Agent({ - host: serverUrl.hostname, - port: serverUrl.port || (isSecure ? 443 : 80) - }); - } - - var requestOptions = { - port: serverUrl.port || (isSecure ? 443 : 80), - host: serverUrl.hostname, - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Version': options.value.protocolVersion, - 'Sec-WebSocket-Key': key - } - }; - if (options.value.protocol) { - requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; - } - if (options.value.host) { - requestOptions.headers['Host'] = options.value.host; - } - - if (isNodeV4) { - requestOptions.path = (serverUrl.pathname || '/') + (serverUrl.search || ''); - requestOptions.agent = agent; - } - else requestOptions.path = serverUrl.path || '/'; - if (isUnixSocket) { - requestOptions.socketPath = serverUrl.pathname; - } - if (options.value.origin) { - if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; - else requestOptions.headers['Origin'] = options.value.origin; - } - - var self = this; - var req = httpObj.request(requestOptions); - (isNodeV4 ? agent : req).on('error', function(error) { - self.emit('error', error); - cleanupWebsocketResources.call(this, error); - }); - (isNodeV4 ? agent : req).once('response', function(res) { - var error = new Error('unexpected server response (' + res.statusCode + ')'); - self.emit('error', error); - cleanupWebsocketResources.call(this, error); - }); - (isNodeV4 ? agent : req).once('upgrade', function(res, socket, upgradeHead) { - if (self.readyState == WebSocket.CLOSED) { - // client closed before server accepted connection - self.emit('close'); - removeAllListeners(self); - socket.end(); - return; - } - var serverKey = res.headers['sec-websocket-accept']; - if (typeof serverKey == 'undefined' || serverKey !== expectedServerKey) { - self.emit('error', 'invalid server key'); - removeAllListeners(self); - socket.end(); - return; - } - - establishConnection.call(self, Receiver, Sender, socket, upgradeHead); - - // perform cleanup on http resources - removeAllListeners(isNodeV4 ? agent : req); - req = null; - agent = null; - }); - - req.end(); - this.readyState = WebSocket.CONNECTING; -} - -function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { - this._socket = socket; - socket.setTimeout(0); - socket.setNoDelay(true); - var self = this; - this._receiver = new ReceiverClass(); - - // socket cleanup handlers - socket.on('end', cleanupWebsocketResources.bind(this)); - socket.on('close', cleanupWebsocketResources.bind(this)); - socket.on('error', cleanupWebsocketResources.bind(this)); - - // ensure that the upgradeHead is added to the receiver - function firstHandler(data) { - if (self.readyState != WebSocket.OPEN) return; - if (upgradeHead && upgradeHead.length > 0) { - self.bytesReceived += upgradeHead.length; - var head = upgradeHead; - upgradeHead = null; - self._receiver.add(head); - } - dataHandler = realHandler; - if (data) { - self.bytesReceived += data.length; - self._receiver.add(data); - } - } - // subsequent packets are pushed straight to the receiver - function realHandler(data) { - if (data) self.bytesReceived += data.length; - self._receiver.add(data); - } - var dataHandler = firstHandler; - socket.on('data', dataHandler); - // if data was passed along with the http upgrade, - // this will schedule a push of that on to the receiver. - // this has to be done on next tick, since the caller - // hasn't had a chance to set event handlers on this client - // object yet. - process.nextTick(firstHandler); - - // receiver event handlers - self._receiver.ontext = function (data, flags) { - flags = flags || {}; - self.emit('message', data, flags); - }; - self._receiver.onbinary = function (data, flags) { - flags = flags || {}; - flags.binary = true; - self.emit('message', data, flags); - }; - self._receiver.onping = function(data, flags) { - flags = flags || {}; - self.pong(data, {mask: !self._isServer, binary: flags.binary === true}, true); - self.emit('ping', data, flags); - }; - self._receiver.onpong = function(data, flags) { - self.emit('pong', data, flags); - }; - self._receiver.onclose = function(code, data, flags) { - flags = flags || {}; - self.close(code, data); - }; - self._receiver.onerror = function(reason, errorCode) { - // close the connection when the receiver reports a HyBi error code - self.close(typeof errorCode != 'undefined' ? errorCode : 1002, ''); - self.emit('error', reason, errorCode); - }; - - // finalize the client - this._sender = new SenderClass(socket); - this._sender.on('error', function(error) { - self.close(1002, ''); - self.emit('error', error); - }); - this.readyState = WebSocket.OPEN; - this.emit('open'); -} - -function startQueue(instance) { - instance._queue = instance._queue || []; -} - -function executeQueueSends(instance) { - var queue = instance._queue; - if (typeof queue == 'undefined') return; - delete instance._queue; - for (var i = 0, l = queue.length; i < l; ++i) { - queue[i](); - } -} - -function sendStream(instance, stream, options, cb) { - stream.on('data', function(data) { - if (instance.readyState != WebSocket.OPEN) { - if (typeof cb == 'function') cb(new Error('not opened')); - else { - delete instance._queue; - instance.emit('error', new Error('not opened')); - } - return; - } - options.fin = false; - instance._sender.send(data, options); - }); - stream.on('end', function() { - if (instance.readyState != WebSocket.OPEN) { - if (typeof cb == 'function') cb(new Error('not opened')); - else { - delete instance._queue; - instance.emit('error', new Error('not opened')); - } - return; - } - options.fin = true; - instance._sender.send(null, options); - if (typeof cb == 'function') cb(null); - }); -} - -function cleanupWebsocketResources(error) { - if (this.readyState == WebSocket.CLOSED) return; - var emitClose = this.readyState != WebSocket.CONNECTING; - this.readyState = WebSocket.CLOSED; - - clearTimeout(this._closeTimer); - - if (this._socket) { - removeAllListeners(this._socket); - // catch all socket error after removing all standard handlers - var socket = this._socket; - this._socket.on('error', function() { - try { socket.destroy(); } catch (e) {} - }); - try { - if (!error) this._socket.end(); - else this._socket.terminate(); - } - catch (e) { /* Ignore termination errors */ } - this._socket = null; - } - if (this._sender) { - removeAllListeners(this._sender); - this._sender = null; - } - if (this._receiver) { - this._receiver.cleanup(); - this._receiver = null; - } - if (emitClose) this.emit('close', this._closeCode || 1000, this._closeMessage || ''); - removeAllListeners(this); - this.on('error', function() {}); // catch all errors after this - delete this._queue; -} - -function removeAllListeners(instance) { - if (isNodeV4) { - // node v4 doesn't *actually* remove all listeners globally, - // so we do that instead - instance._events = {}; - } - else instance.removeAllListeners(); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js deleted file mode 100644 index 42c2c35f..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js +++ /dev/null @@ -1,425 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util') - , events = require('events') - , http = require('http') - , crypto = require('crypto') - , url = require('url') - , Options = require('options') - , WebSocket = require('./WebSocket') - , tls = require('tls') - , url = require('url'); - -/** - * WebSocket Server implementation - */ - -function WebSocketServer(options, callback) { - options = new Options({ - host: '0.0.0.0', - port: null, - server: null, - verifyClient: null, - path: null, - noServer: false, - disableHixie: false, - clientTracking: true - }).merge(options); - if (!options.value.port && !options.value.server && !options.value.noServer) { - throw new TypeError('`port` or a `server` must be provided'); - } - - var self = this; - - if (options.value.port) { - this._server = http.createServer(function (req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('Not implemented'); - }); - this._server.listen(options.value.port, options.value.host, callback); - this._closeServer = function() { self._server.close(); }; - } - else if (options.value.server) { - this._server = options.value.server; - if (options.value.path) { - // take note of the path, to avoid collisions when multiple websocket servers are - // listening on the same http server - if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { - throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); - } - if (typeof this._server._webSocketPaths !== 'object') { - this._server._webSocketPaths = {}; - } - this._server._webSocketPaths[options.value.path] = 1; - } - } - if (this._server) this._server.once('listening', function() { self.emit('listening'); }); - - if (typeof this._server != 'undefined') { - this._server.on('error', function(error) { - self.emit('error', error) - }); - this._server.on('upgrade', function(req, socket, upgradeHead) { - self.handleUpgrade(req, socket, upgradeHead, function(client) { - self.emit('connection'+req.url, client); - self.emit('connection', client); - }); - }); - } - - this.options = options.value; - this.path = options.value.path; - this.clients = []; -} - -/** - * Inherits from EventEmitter. - */ - -util.inherits(WebSocketServer, events.EventEmitter); - -/** - * Immediately shuts down the connection. - * - * @api public - */ - -WebSocketServer.prototype.close = function() { - // terminate all associated clients - var error = null; - try { - for (var i = 0, l = this.clients.length; i < l; ++i) { - this.clients[i].terminate(); - } - } - catch (e) { - error = e; - } - - // remove path descriptor, if any - if (this.path && this._server._webSocketPaths) { - delete this._server._webSocketPaths[this.path]; - if (Object.keys(this._server._webSocketPaths).length == 0) { - delete this._server._webSocketPaths; - } - } - - // close the http server if it was internally created - try { - if (typeof this._closeServer !== 'undefined') { - this._closeServer(); - } - } - finally { - delete this._server; - } - if (error) throw error; -} - -/** - * Handle a HTTP Upgrade request. - * - * @api public - */ - -WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { - // check for wrong path - if (this.options.path) { - var u = url.parse(req.url); - if (u && u.pathname !== this.options.path) return; - } - - if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); - else handleHybiUpgrade.apply(this, arguments); -} - -module.exports = WebSocketServer; - -/** - * Entirely private apis, - * which may or may not be bound to a sepcific WebSocket instance. - */ - -function handleHybiUpgrade(req, socket, upgradeHead, cb) { - // handle premature socket errors - var errorHandler = function() { - try { socket.destroy(); } catch (e) {} - } - socket.on('error', errorHandler); - - // verify key presence - if (!req.headers['sec-websocket-key']) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - // verify version - var version = parseInt(req.headers['sec-websocket-version']); - if ([8, 13].indexOf(version) === -1) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - // verify client - var origin = version < 13 ? - req.headers['sec-websocket-origin'] : - req.headers['origin']; - - // handler to call when the connection sequence completes - var self = this; - var completeHybiUpgrade = function() { - var protocol = req.headers['sec-websocket-protocol']; - - // calc key - var key = req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - if (typeof protocol != 'undefined') { - headers.push('Sec-WebSocket-Protocol: ' + protocol); - } - - // allows external modification/inspection of handshake headers - self.emit('headers', headers); - - socket.setTimeout(0); - socket.setNoDelay(true); - try { - socket.write(headers.concat('', '').join('\r\n')); - } - catch (e) { - // if the upgrade write fails, shut the connection down hard - try { socket.destroy(); } catch (e) {} - return; - } - - var client = new WebSocket([req, socket, upgradeHead], { - protocolVersion: version, - protocol: protocol - }); - - if (self.options.clientTracking) { - self.clients.push(client); - client.on('close', function() { - var index = self.clients.indexOf(client); - if (index != -1) { - self.clients.splice(index, 1); - } - }); - } - - // signal upgrade complete - socket.removeListener('error', errorHandler); - cb(client); - } - - // optionally call external client verification handler - if (typeof this.options.verifyClient == 'function') { - var info = { - origin: origin, - secure: typeof req.connection.encrypted !== 'undefined', - req: req - }; - if (this.options.verifyClient.length == 2) { - this.options.verifyClient(info, function(result) { - if (!result) abortConnection(socket, 401, 'Unauthorized') - else completeHybiUpgrade(); - }); - return; - } - else if (!this.options.verifyClient(info)) { - abortConnection(socket, 401, 'Unauthorized'); - return; - } - } - - completeHybiUpgrade(); -} - -function handleHixieUpgrade(req, socket, upgradeHead, cb) { - // handle premature socket errors - var errorHandler = function() { - try { socket.destroy(); } catch (e) {} - } - socket.on('error', errorHandler); - - // bail if options prevent hixie - if (this.options.disableHixie) { - abortConnection(socket, 401, 'Hixie support disabled'); - return; - } - - // verify key presence - if (!req.headers['sec-websocket-key2']) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - var origin = req.headers['origin'] - , self = this; - - // setup handshake completion to run after client has been verified - var onClientVerified = function() { - var wshost; - if (!req.headers['x-forwarded-host']) - wshost = req.headers.host; - else - wshost = req.headers['x-forwarded-host']; - var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url - , protocol = req.headers['sec-websocket-protocol']; - - // handshake completion code to run once nonce has been successfully retrieved - var completeHandshake = function(nonce, rest) { - // calculate key - var k1 = req.headers['sec-websocket-key1'] - , k2 = req.headers['sec-websocket-key2'] - , md5 = crypto.createHash('md5'); - - [k1, k2].forEach(function (k) { - var n = parseInt(k.replace(/[^\d]/g, '')) - , spaces = k.replace(/[^ ]/g, '').length; - if (spaces === 0 || n % spaces !== 0){ - abortConnection(socket, 400, 'Bad Request'); - return; - } - n /= spaces; - md5.update(String.fromCharCode( - n >> 24 & 0xFF, - n >> 16 & 0xFF, - n >> 8 & 0xFF, - n & 0xFF)); - }); - md5.update(nonce.toString('binary')); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Location: ' + location - ]; - if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); - if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); - - socket.setTimeout(0); - socket.setNoDelay(true); - try { - // merge header and hash buffer - var headerBuffer = new Buffer(headers.concat('', '').join('\r\n')); - var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); - var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); - headerBuffer.copy(handshakeBuffer, 0); - hashBuffer.copy(handshakeBuffer, headerBuffer.length); - - // do a single write, which - upon success - causes a new client websocket to be setup - socket.write(handshakeBuffer, 'binary', function(err) { - if (err) return; // do not create client if an error happens - var client = new WebSocket([req, socket, rest], { - protocolVersion: 'hixie-76', - protocol: protocol - }); - if (self.options.clientTracking) { - self.clients.push(client); - client.on('close', function() { - var index = self.clients.indexOf(client); - if (index != -1) { - self.clients.splice(index, 1); - } - }); - } - - // signal upgrade complete - socket.removeListener('error', errorHandler); - cb(client); - }); - } - catch (e) { - try { socket.destroy(); } catch (e) {} - return; - } - } - - // retrieve nonce - var nonceLength = 8; - if (upgradeHead && upgradeHead.length >= nonceLength) { - var nonce = upgradeHead.slice(0, nonceLength); - var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; - completeHandshake.call(self, nonce, rest); - } - else { - // nonce not present in upgradeHead, so we must wait for enough data - // data to arrive before continuing - var nonce = new Buffer(nonceLength); - upgradeHead.copy(nonce, 0); - var received = upgradeHead.length; - var rest = null; - var handler = function (data) { - var toRead = Math.min(data.length, nonceLength - received); - if (toRead === 0) return; - data.copy(nonce, received, 0, toRead); - received += toRead; - if (received == nonceLength) { - socket.removeListener('data', handler); - if (toRead < data.length) rest = data.slice(toRead); - completeHandshake.call(self, nonce, rest); - } - } - socket.on('data', handler); - } - } - - // verify client - if (typeof this.options.verifyClient == 'function') { - var info = { - origin: origin, - secure: typeof req.connection.encrypted !== 'undefined', - req: req - }; - if (this.options.verifyClient.length == 2) { - var self = this; - this.options.verifyClient(info, function(result) { - if (!result) abortConnection(socket, 401, 'Unauthorized') - else onClientVerified.apply(self); - }); - return; - } - else if (!this.options.verifyClient(info)) { - abortConnection(socket, 401, 'Unauthorized'); - return; - } - } - - // no client verification required - onClientVerified(); -} - -function abortConnection(socket, code, name) { - try { - var response = [ - 'HTTP/1.1 ' + code + ' ' + name, - 'Content-type: text/html' - ]; - socket.write(response.concat('', '').join('\r\n')); - } - catch (e) { /* ignore errors - we've aborted this connection */ } - finally { - // ensure that an early aborted connection is shut down completely - try { socket.destroy(); } catch (e) {} - } -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js deleted file mode 100644 index 37cafe11..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js +++ /dev/null @@ -1,5 +0,0 @@ -/// shim for browser packaging - -module.exports = function() { - return global.WebSocket || global.MozWebSocket; -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/.npmignore b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/.npmignore deleted file mode 100644 index f1250e58..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/.travis.yml b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/.travis.yml deleted file mode 100644 index f1d0f13c..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/History.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/History.md deleted file mode 100644 index 4961d2e2..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/History.md +++ /dev/null @@ -1,107 +0,0 @@ - -0.6.1 / 2012-06-01 -================== - - * Added: append (yes or no) on confirmation - * Added: allow node.js v0.7.x - -0.6.0 / 2012-04-10 -================== - - * Added `.prompt(obj, callback)` support. Closes #49 - * Added default support to .choose(). Closes #41 - * Fixed the choice example - -0.5.1 / 2011-12-20 -================== - - * Fixed `password()` for recent nodes. Closes #36 - -0.5.0 / 2011-12-04 -================== - - * Added sub-command option support [itay] - -0.4.3 / 2011-12-04 -================== - - * Fixed custom help ordering. Closes #32 - -0.4.2 / 2011-11-24 -================== - - * Added travis support - * Fixed: line-buffered input automatically trimmed. Closes #31 - -0.4.1 / 2011-11-18 -================== - - * Removed listening for "close" on --help - -0.4.0 / 2011-11-15 -================== - - * Added support for `--`. Closes #24 - -0.3.3 / 2011-11-14 -================== - - * Fixed: wait for close event when writing help info [Jerry Hamlet] - -0.3.2 / 2011-11-01 -================== - - * Fixed long flag definitions with values [felixge] - -0.3.1 / 2011-10-31 -================== - - * Changed `--version` short flag to `-V` from `-v` - * Changed `.version()` so it's configurable [felixge] - -0.3.0 / 2011-10-31 -================== - - * Added support for long flags only. Closes #18 - -0.2.1 / 2011-10-24 -================== - - * "node": ">= 0.4.x < 0.7.0". Closes #20 - -0.2.0 / 2011-09-26 -================== - - * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] - -0.1.0 / 2011-08-24 -================== - - * Added support for custom `--help` output - -0.0.5 / 2011-08-18 -================== - - * Changed: when the user enters nothing prompt for password again - * Fixed issue with passwords beginning with numbers [NuckChorris] - -0.0.4 / 2011-08-15 -================== - - * Fixed `Commander#args` - -0.0.3 / 2011-08-15 -================== - - * Added default option value support - -0.0.2 / 2011-08-15 -================== - - * Added mask support to `Command#password(str[, mask], fn)` - * Added `Command#password(str, fn)` - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Makefile b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Makefile deleted file mode 100644 index 00746255..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -TESTS = $(shell find test/test.*.js) - -test: - @./test/run $(TESTS) - -.PHONY: test \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md deleted file mode 100644 index b8328c37..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md +++ /dev/null @@ -1,262 +0,0 @@ -# Commander.js - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). - - [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineappe'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineappe - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -function list(val) { - return val.split(',').map(Number); -} - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .prompt(msg, fn) - - Single-line prompt: - -```js -program.prompt('name: ', function(name){ - console.log('hi %s', name); -}); -``` - - Multi-line prompt: - -```js -program.prompt('description:', function(name){ - console.log('hi %s', name); -}); -``` - - Coercion: - -```js -program.prompt('Age: ', Number, function(age){ - console.log('age: %j', age); -}); -``` - -```js -program.prompt('Birthdate: ', Date, function(date){ - console.log('date: %s', date); -}); -``` - -## .password(msg[, mask], fn) - -Prompt for password without echoing: - -```js -program.password('Password: ', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -Prompt for password with mask char "*": - -```js -program.password('Password: ', '*', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -## .confirm(msg, fn) - - Confirm with the given `msg`: - -```js -program.confirm('continue? ', function(ok){ - console.log(' got %j', ok); -}); -``` - -## .choose(list, fn) - - Let the user choose from a `list`: - -```js -var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - -console.log('Choose the coolest pet:'); -program.choose(list, function(i){ - console.log('you chose %d "%s"', i, list[i]); -}); -``` - -## Links - - - [API documentation](http://visionmedia.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/visionmedia/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js deleted file mode 100644 index 06ec1e4b..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/commander'); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/lib/commander.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/lib/commander.js deleted file mode 100644 index 5ba87ebb..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/lib/commander.js +++ /dev/null @@ -1,1026 +0,0 @@ - -/*! - * commander - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , path = require('path') - , tty = require('tty') - , basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command; - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function(){ - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg){ - return arg == this.short - || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this.args = []; - this.name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function(){ - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd){ - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env){ - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name){ - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - return cmd; -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args){ - if (!args.length) return; - var self = this; - args.forEach(function(arg){ - switch (arg[0]) { - case '<': - self.args.push({ required: true, name: arg.slice(1, -1) }); - break; - case '[': - self.args.push({ required: false, name: arg.slice(1, -1) }); - break; - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function(){ - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn){ - var self = this; - this.parent.on(this.name, function(args, unknown){ - // Parse any so-far unknown options - unknown = unknown || []; - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - self.args.forEach(function(arg, i){ - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self.args.length) { - args[self.args.length] = self; - } else { - args.push(self); - } - - fn.apply(this, args); - }); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to false - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => true - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue){ - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if ('function' != typeof fn) defaultValue = fn, fn = null; - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val){ - // coercion - if (null != val && fn) val = fn(val); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv){ - // store raw args - this.rawArgs = argv; - - // guess name - if (!this.name) this.name = basename(argv[1]); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - this.args = parsed.args; - return this.parseArgs(this.args, parsed.unknown); -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args){ - var ret = [] - , arg; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c){ - ret.push('-' + c); - }); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown){ - var cmds = this.commands - , len = cmds.length - , name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg){ - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv){ - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - if ('-' == arg[0]) return this.optionMissingArgument(option, arg); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || '-' == arg[0]) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name){ - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag){ - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag){ - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags){ - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function(){ - console.log(str); - process.exit(0); - }); - return this; -}; - -/** - * Set the description `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str){ - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str){ - var args = this.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }); - - var usage = '[options' - + (this.commands.length ? '] [command' : '') - + ']' - + (this.args.length ? ' ' + args : ''); - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function(){ - return this.options.reduce(function(max, option){ - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function(){ - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option){ - return pad(option.flags, width) - + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function(){ - if (!this.commands.length) return ''; - return [ - '' - , ' Commands:' - , '' - , this.commands.map(function(cmd){ - var args = cmd.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }).join(' '); - - return cmd.name - + (cmd.options.length - ? ' [options]' - : '') + ' ' + args - + (cmd.description() - ? '\n' + cmd.description() - : ''); - }).join('\n\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function(){ - return [ - '' - , ' Usage: ' + this.name + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Prompt for a `Number`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForNumber = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseNumber(val){ - val = Number(val); - if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); - fn(val); - }); -}; - -/** - * Prompt for a `Date`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForDate = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseDate(val){ - val = new Date(val); - if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); - fn(val); - }); -}; - -/** - * Single-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptSingleLine = function(str, fn){ - if ('function' == typeof arguments[2]) { - return this['promptFor' + (fn.name || fn)](str, arguments[2]); - } - - process.stdout.write(str); - process.stdin.setEncoding('utf8'); - process.stdin.once('data', function(val){ - fn(val.trim()); - }).resume(); -}; - -/** - * Multi-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptMultiLine = function(str, fn){ - var buf = []; - console.log(str); - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(val){ - if ('\n' == val || '\r\n' == val) { - process.stdin.removeAllListeners('data'); - fn(buf.join('\n')); - } else { - buf.push(val.trimRight()); - } - }).resume(); -}; - -/** - * Prompt `str` and callback `fn(val)` - * - * Commander supports single-line and multi-line prompts. - * To issue a single-line prompt simply add white-space - * to the end of `str`, something like "name: ", whereas - * for a multi-line prompt omit this "description:". - * - * - * Examples: - * - * program.prompt('Username: ', function(name){ - * console.log('hi %s', name); - * }); - * - * program.prompt('Description:', function(desc){ - * console.log('description was "%s"', desc.trim()); - * }); - * - * @param {String|Object} str - * @param {Function} fn - * @api public - */ - -Command.prototype.prompt = function(str, fn){ - var self = this; - - if ('string' == typeof str) { - if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); - this.promptMultiLine(str, fn); - } else { - var keys = Object.keys(str) - , obj = {}; - - function next() { - var key = keys.shift() - , label = str[key]; - - if (!key) return fn(obj); - self.prompt(label, function(val){ - obj[key] = val; - next(); - }); - } - - next(); - } -}; - -/** - * Prompt for password with `str`, `mask` char and callback `fn(val)`. - * - * The mask string defaults to '', aka no output is - * written while typing, you may want to use "*" etc. - * - * Examples: - * - * program.password('Password: ', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * program.password('Password: ', '*', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {String} mask - * @param {Function} fn - * @api public - */ - -Command.prototype.password = function(str, mask, fn){ - var self = this - , buf = ''; - - // default mask - if ('function' == typeof mask) { - fn = mask; - mask = ''; - } - - process.stdin.resume(); - tty.setRawMode(true); - process.stdout.write(str); - - // keypress - process.stdin.on('keypress', function(c, key){ - if (key && 'enter' == key.name) { - console.log(); - process.stdin.removeAllListeners('keypress'); - tty.setRawMode(false); - if (!buf.trim().length) return self.password(str, mask, fn); - fn(buf); - return; - } - - if (key && key.ctrl && 'c' == key.name) { - console.log('%s', buf); - process.exit(); - } - - process.stdout.write(mask); - buf += c; - }).resume(); -}; - -/** - * Confirmation prompt with `str` and callback `fn(bool)` - * - * Examples: - * - * program.confirm('continue? ', function(ok){ - * console.log(' got %j', ok); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {Function} fn - * @api public - */ - - -Command.prototype.confirm = function(str, fn, verbose){ - var self = this; - this.prompt(str, function(ok){ - if (!ok.trim()) { - if (!verbose) str += '(yes or no) '; - return self.confirm(str, fn, true); - } - fn(parseBool(ok)); - }); -}; - -/** - * Choice prompt with `list` of items and callback `fn(index, item)` - * - * Examples: - * - * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - * - * console.log('Choose the coolest pet:'); - * program.choose(list, function(i){ - * console.log('you chose %d "%s"', i, list[i]); - * process.stdin.destroy(); - * }); - * - * @param {Array} list - * @param {Number|Function} index or fn - * @param {Function} fn - * @api public - */ - -Command.prototype.choose = function(list, index, fn){ - var self = this - , hasDefault = 'number' == typeof index; - - if (!hasDefault) { - fn = index; - index = null; - } - - list.forEach(function(item, i){ - if (hasDefault && i == index) { - console.log('* %d) %s', i + 1, item); - } else { - console.log(' %d) %s', i + 1, item); - } - }); - - function again() { - self.prompt(' : ', function(val){ - val = parseInt(val, 10) - 1; - if (hasDefault && isNaN(val)) val = index; - - if (null == list[val]) { - again(); - } else { - fn(val, list[val]); - } - }); - } - - again(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word){ - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Parse a boolean `str`. - * - * @param {String} str - * @return {Boolean} - * @api private - */ - -function parseBool(str) { - return /^y|yes|ok|true$/i.test(str); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - process.stdout.write(cmd.helpInformation()); - cmd.emit('--help'); - process.exit(0); - } - } -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json deleted file mode 100644 index 441afbc2..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "commander", - "version": "0.6.1", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt", - "stdin" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/commander.js.git" - }, - "dependencies": {}, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.4.x" - }, - "_id": "commander@0.6.1", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "ff86cf589fafafb9503fecdc54fef315b83283b7" - }, - "_from": "commander@~0.6.1" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore deleted file mode 100644 index 6bfffbb7..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -npm-debug.log -node_modules -.*.swp -.lock-* -build/ diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile deleted file mode 100644 index 7496b6fc..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -ALL_TESTS = $(shell find test/ -name '*.test.js') - -run-tests: - @./node_modules/.bin/mocha \ - -t 2000 \ - $(TESTFLAGS) \ - $(TESTS) - -test: - @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests - -.PHONY: test diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md deleted file mode 100644 index 7f44b3e1..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# options.js # - -A very light-weight in-code option parsers for node.js. diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js deleted file mode 100644 index 3ff81af2..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js +++ /dev/null @@ -1,75 +0,0 @@ -var fs = require('fs'); - -function Options(defaults) { - var internalValues = {}; - var values = this.value = {}; - Object.keys(defaults).forEach(function(key) { - internalValues[key] = defaults[key]; - Object.defineProperty(values, key, { - get: function() { return internalValues[key]; }, - configurable: false, - enumerable: true - }); - }); - this.reset = function() { - Object.keys(defaults).forEach(function(key) { - internalValues[key] = defaults[key]; - }); - return this; - } - this.merge = function(options, required) { - options = options || {}; - if (Object.prototype.toString.call(required) === '[object Array]') { - var missing = []; - for (var i = 0, l = required.length; i < l; ++i) { - var key = required[i]; - if (typeof options[key] === 'undefined') { - missing.push(key); - } - } - if (missing.length > 0) { - if (missing.length > 1) { - throw new Error('options ' + - missing.slice(0, missing.length - 1).join(', ') + ' and ' + - missing[missing.length - 1] + ' must be defined'); - } - else throw new Error('option ' + missing[0] + ' must be defined'); - } - } - Object.keys(options).forEach(function(key) { - if (typeof internalValues[key] !== 'undefined') { - internalValues[key] = options[key]; - } - }); - return this; - } - this.copy = function(keys) { - var obj = {}; - Object.keys(defaults).forEach(function(key) { - if (keys.indexOf(key) !== -1) { - obj[key] = values[key]; - } - }); - return obj; - } - this.read = function(filename, cb) { - if (typeof cb == 'function') { - var self = this; - fs.readFile(filename, function(error, data) { - if (error) return cb(error); - var conf = JSON.parse(data); - self.merge(conf); - cb(); - }); - } - else { - var conf = JSON.parse(fs.readFileSync(filename)); - this.merge(conf); - } - return this; - } - Object.freeze(values); - Object.freeze(this); -} - -module.exports = Options; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json deleted file mode 100644 index 65d182be..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "name": "options", - "description": "A very light-weight in-code option parsers for node.js.", - "version": "0.0.3", - "repository": { - "type": "git", - "url": "git://github.com/einaros/options.js.git" - }, - "main": "lib/options", - "scripts": { - "test": "make test" - }, - "engines": { - "node": ">=0.4.0" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "latest", - "expect.js": "latest" - }, - "_id": "options@0.0.3", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "27d789ed4f14162d154b51fc09cdab2cbe1c5a41" - }, - "_from": "options@latest" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test/fixtures/test.conf b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test/fixtures/test.conf deleted file mode 100644 index 6e624441..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test/fixtures/test.conf +++ /dev/null @@ -1,4 +0,0 @@ -{ - "a": "foobar", - "b": false -} \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test/options.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test/options.test.js deleted file mode 100644 index cadfa6bd..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test/options.test.js +++ /dev/null @@ -1,119 +0,0 @@ -var Options = require('options') - , expect = require('expect.js'); - -describe('Options', function() { - describe('#ctor', function() { - it('initializes options', function() { - var option = new Options({a: true, b: false}); - expect(option.value.a).to.equal(true); - expect(option.value.b).to.equal(false); - }) - }) - - describe('#merge', function() { - it('merges options from another object', function() { - var option = new Options({a: true, b: false}); - option.merge({b: true}); - expect(option.value.a).to.equal(true); - expect(option.value.b).to.equal(true); - }) - it('does nothing when arguments are undefined', function() { - var option = new Options({a: true, b: false}); - option.merge(undefined); - expect(option.value.a).to.equal(true); - expect(option.value.b).to.equal(false); - }) - it('cannot set values that werent already there', function() { - var option = new Options({a: true, b: false}); - option.merge({c: true}); - expect(typeof option.value.c).to.equal('undefined'); - }) - it('can require certain options to be defined', function() { - var option = new Options({a: true, b: false, c: 3}); - var caughtException = false; - try { - option.merge({}, ['a', 'b', 'c']); - } - catch (e) { - caughtException = e.toString() == 'Error: options a, b and c must be defined'; - } - expect(caughtException).to.equal(true); - }) - it('can require certain options to be defined, when options are undefined', function() { - var option = new Options({a: true, b: false, c: 3}); - var caughtException = false; - try { - option.merge(undefined, ['a', 'b', 'c']); - } - catch (e) { - caughtException = e.toString() == 'Error: options a, b and c must be defined'; - } - expect(caughtException).to.equal(true); - }) - it('returns "this"', function() { - var option = new Options({a: true, b: false, c: 3}); - expect(option.merge()).to.equal(option); - }) - }) - - describe('#copy', function() { - it('returns a new object with the indicated options', function() { - var option = new Options({a: true, b: false, c: 3}); - var obj = option.copy(['a', 'c']); - expect(obj.a).to.equal(true); - expect(obj.c).to.equal(3); - expect(typeof obj.b).to.equal('undefined'); - }) - }) - - describe('#value', function() { - it('can be enumerated', function() { - var option = new Options({a: true, b: false}); - expect(Object.keys(option.value).length).to.equal(2); - }) - it('can not be used to set values', function() { - var option = new Options({a: true, b: false}); - option.value.b = true; - expect(option.value.b).to.equal(false); - }) - it('can not be used to add values', function() { - var option = new Options({a: true, b: false}); - option.value.c = 3; - expect(typeof option.value.c).to.equal('undefined'); - }) - }) - - describe('#read', function() { - it('reads and merges config from a file', function() { - var option = new Options({a: true, b: true}); - option.read(__dirname + '/fixtures/test.conf'); - expect(option.value.a).to.equal('foobar'); - expect(option.value.b).to.equal(false); - }) - - it('asynchronously reads and merges config from a file when a callback is passed', function(done) { - var option = new Options({a: true, b: true}); - option.read(__dirname + '/fixtures/test.conf', function(error) { - expect(option.value.a).to.equal('foobar'); - expect(option.value.b).to.equal(false); - done(); - }); - }) - }) - - describe('#reset', function() { - it('resets options to defaults', function() { - var option = new Options({a: true, b: false}); - option.merge({b: true}); - expect(option.value.b).to.equal(true); - option.reset(); - expect(option.value.b).to.equal(false); - }) - }) - - it('is immutable', function() { - var option = new Options({a: true, b: false}); - option.foo = 2; - expect(typeof option.foo).to.equal('undefined'); - }) -}) diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore deleted file mode 100644 index 6bfffbb7..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -npm-debug.log -node_modules -.*.swp -.lock-* -build/ diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md deleted file mode 100644 index 55eb3c11..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# tinycolor # - -This is a no-fuzz, barebone, zero muppetry color module for node.js. \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js deleted file mode 100644 index f7540468..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js +++ /dev/null @@ -1,3 +0,0 @@ -require('./tinycolor'); -console.log('this should be red and have an underline!'.grey.underline); -console.log('this should have a blue background!'.bgBlue); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json deleted file mode 100644 index d5f2b9f6..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "name": "tinycolor", - "description": "a to-the-point color module for node", - "version": "0.0.1", - "repository": { - "type": "git", - "url": "git://github.com/einaros/tinycolor.git" - }, - "engines": { - "node": ">=0.4.0" - }, - "dependencies": {}, - "devDependencies": {}, - "main": "tinycolor", - "_id": "tinycolor@0.0.1", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "6c17e38770870163a669f16935bc99747f18d5c5" - }, - "_from": "tinycolor@0.x" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js deleted file mode 100644 index 36e552c4..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js +++ /dev/null @@ -1,31 +0,0 @@ -var styles = { - 'bold': ['\033[1m', '\033[22m'], - 'italic': ['\033[3m', '\033[23m'], - 'underline': ['\033[4m', '\033[24m'], - 'inverse': ['\033[7m', '\033[27m'], - 'black': ['\033[30m', '\033[39m'], - 'red': ['\033[31m', '\033[39m'], - 'green': ['\033[32m', '\033[39m'], - 'yellow': ['\033[33m', '\033[39m'], - 'blue': ['\033[34m', '\033[39m'], - 'magenta': ['\033[35m', '\033[39m'], - 'cyan': ['\033[36m', '\033[39m'], - 'white': ['\033[37m', '\033[39m'], - 'default': ['\033[39m', '\033[39m'], - 'grey': ['\033[90m', '\033[39m'], - 'bgBlack': ['\033[40m', '\033[49m'], - 'bgRed': ['\033[41m', '\033[49m'], - 'bgGreen': ['\033[42m', '\033[49m'], - 'bgYellow': ['\033[43m', '\033[49m'], - 'bgBlue': ['\033[44m', '\033[49m'], - 'bgMagenta': ['\033[45m', '\033[49m'], - 'bgCyan': ['\033[46m', '\033[49m'], - 'bgWhite': ['\033[47m', '\033[49m'], - 'bgDefault': ['\033[49m', '\033[49m'] -} -Object.keys(styles).forEach(function(style) { - Object.defineProperty(String.prototype, style, { - get: function() { return styles[style][0] + this + styles[style][1]; }, - enumerable: false - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json deleted file mode 100644 index e0247f90..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "name": "ws", - "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", - "version": "0.4.25", - "repository": { - "type": "git", - "url": "git://github.com/einaros/ws.git" - }, - "bin": { - "wscat": "./bin/wscat" - }, - "scripts": { - "test": "make test", - "install": "(node-gyp rebuild 2> builderror.log) || (exit 0)" - }, - "engines": { - "node": ">=0.4.0" - }, - "dependencies": { - "commander": "~0.6.1", - "tinycolor": "0.x", - "options": "latest" - }, - "devDependencies": { - "mocha": "~1.2.1", - "should": "0.6.x", - "expect.js": "0.1.x", - "benchmark": "0.3.x", - "ansi": "latest" - }, - "browser": { - "./index.js": "./lib/browser.js" - }, - "_id": "ws@0.4.25", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "8439213ff8837c8790aac399a312e1d4b35f62cc" - }, - "_from": "ws@0.4.x" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc deleted file mode 100644 index 866c28b2..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc +++ /dev/null @@ -1,115 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace v8; -using namespace node; - -class BufferUtil : public ObjectWrap -{ -public: - - static void Initialize(v8::Handle target) - { - HandleScope scope; - Local t = FunctionTemplate::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - NODE_SET_METHOD(t->GetFunction(), "unmask", BufferUtil::Unmask); - NODE_SET_METHOD(t->GetFunction(), "mask", BufferUtil::Mask); - NODE_SET_METHOD(t->GetFunction(), "merge", BufferUtil::Merge); - target->Set(String::NewSymbol("BufferUtil"), t->GetFunction()); - } - -protected: - - static Handle New(const Arguments& args) - { - HandleScope scope; - BufferUtil* bufferUtil = new BufferUtil(); - bufferUtil->Wrap(args.This()); - return args.This(); - } - - static Handle Merge(const Arguments& args) - { - HandleScope scope; - Local bufferObj = args[0]->ToObject(); - char* buffer = Buffer::Data(bufferObj); - Local array = Local::Cast(args[1]); - unsigned int arrayLength = array->Length(); - unsigned int offset = 0; - unsigned int i; - for (i = 0; i < arrayLength; ++i) { - Local src = array->Get(i)->ToObject(); - unsigned int length = Buffer::Length(src); - memcpy(buffer + offset, Buffer::Data(src), length); - offset += length; - } - return scope.Close(True()); - } - - static Handle Unmask(const Arguments& args) - { - HandleScope scope; - Local buffer_obj = args[0]->ToObject(); - unsigned int length = Buffer::Length(buffer_obj); - Local mask_obj = args[1]->ToObject(); - unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); - unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); - unsigned int len32 = length / 4; - unsigned int i; - for (i = 0; i < len32; ++i) *(from + i) ^= *mask; - from += i; - switch (length % 4) { - case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; - case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; - case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; - case 0:; - } - return True(); - } - - static Handle Mask(const Arguments& args) - { - HandleScope scope; - Local buffer_obj = args[0]->ToObject(); - Local mask_obj = args[1]->ToObject(); - unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); - Local output_obj = args[2]->ToObject(); - unsigned int dataOffset = args[3]->Int32Value(); - unsigned int length = args[4]->Int32Value(); - unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); - unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); - unsigned int len32 = length / 4; - unsigned int i; - for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; - to += i; - from += i; - switch (length % 4) { - case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); - case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); - case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); - case 0:; - } - return True(); - } -}; - -extern "C" void init (Handle target) -{ - HandleScope scope; - BufferUtil::Initialize(target); -} - -NODE_MODULE(bufferutil, init) diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc deleted file mode 100644 index b9001645..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc +++ /dev/null @@ -1,143 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -#include -#include -#include -#include -#include -#include -#include - -using namespace v8; -using namespace node; - -#define UNI_SUR_HIGH_START (uint32_t) 0xD800 -#define UNI_SUR_LOW_END (uint32_t) 0xDFFF -#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD -#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF - -static const uint8_t trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; - -static const uint32_t offsetsFromUTF8[6] = { - 0x00000000, 0x00003080, 0x000E2080, - 0x03C82080, 0xFA082080, 0x82082080 -}; - -static int isLegalUTF8(const uint8_t *source, const int length) -{ - uint8_t a; - const uint8_t *srcptr = source+length; - switch (length) { - default: return 0; - /* Everything else falls through when "true"... */ - /* RFC3629 makes 5 & 6 bytes UTF-8 illegal - case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */ - case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 2: if ((a = (*--srcptr)) > 0xBF) return 0; - switch (*source) { - /* no fall-through in this inner switch */ - case 0xE0: if (a < 0xA0) return 0; break; - case 0xED: if (a > 0x9F) return 0; break; - case 0xF0: if (a < 0x90) return 0; break; - case 0xF4: if (a > 0x8F) return 0; break; - default: if (a < 0x80) return 0; - } - - case 1: if (*source >= 0x80 && *source < 0xC2) return 0; - } - if (*source > 0xF4) return 0; - return 1; -} - -int is_valid_utf8 (size_t len, char *value) -{ - /* is the string valid UTF-8? */ - for (unsigned int i = 0; i < len; i++) { - uint32_t ch = 0; - uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]]; - - if (extrabytes + i >= len) - return 0; - - if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0; - - switch (extrabytes) { - case 5 : ch += (uint8_t) value[i++]; ch <<= 6; - case 4 : ch += (uint8_t) value[i++]; ch <<= 6; - case 3 : ch += (uint8_t) value[i++]; ch <<= 6; - case 2 : ch += (uint8_t) value[i++]; ch <<= 6; - case 1 : ch += (uint8_t) value[i++]; ch <<= 6; - case 0 : ch += (uint8_t) value[i]; - } - - ch -= offsetsFromUTF8[extrabytes]; - - if (ch <= UNI_MAX_LEGAL_UTF32) { - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) - return 0; - } else { - return 0; - } - } - - return 1; -} - -class Validation : public ObjectWrap -{ -public: - - static void Initialize(v8::Handle target) - { - HandleScope scope; - Local t = FunctionTemplate::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - NODE_SET_METHOD(t->GetFunction(), "isValidUTF8", Validation::IsValidUTF8); - target->Set(String::NewSymbol("Validation"), t->GetFunction()); - } - -protected: - - static Handle New(const Arguments& args) - { - HandleScope scope; - Validation* validation = new Validation(); - validation->Wrap(args.This()); - return args.This(); - } - - static Handle IsValidUTF8(const Arguments& args) - { - HandleScope scope; - if (!Buffer::HasInstance(args[0])) { - return ThrowException(Exception::Error(String::New("First argument needs to be a buffer"))); - } - Local buffer_obj = args[0]->ToObject(); - char *buffer_data = Buffer::Data(buffer_obj); - size_t buffer_length = Buffer::Length(buffer_obj); - return is_valid_utf8(buffer_length, buffer_data) == 1 ? scope.Close(True()) : scope.Close(False()); - } -}; - -extern "C" void init (Handle target) -{ - HandleScope scope; - Validation::Initialize(target); -} - -NODE_MODULE(validation, init) diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/BufferPool.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/BufferPool.test.js deleted file mode 100644 index 1ee7ff0f..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/BufferPool.test.js +++ /dev/null @@ -1,63 +0,0 @@ -var BufferPool = require('../lib/BufferPool'); -require('should'); - -describe('BufferPool', function() { - describe('#ctor', function() { - it('allocates pool', function() { - var db = new BufferPool(1000); - db.size.should.eql(1000); - }); - }); - describe('#get', function() { - it('grows the pool if necessary', function() { - var db = new BufferPool(1000); - var buf = db.get(2000); - db.size.should.be.above(1000); - db.used.should.eql(2000); - buf.length.should.eql(2000); - }); - it('grows the pool after the first call, if necessary', function() { - var db = new BufferPool(1000); - var buf = db.get(1000); - db.used.should.eql(1000); - db.size.should.eql(1000); - buf.length.should.eql(1000); - var buf2 = db.get(1000); - db.used.should.eql(2000); - db.size.should.be.above(1000); - buf2.length.should.eql(1000); - }); - it('grows the pool according to the growStrategy if necessary', function() { - var db = new BufferPool(1000, function(db, length) { - return db.size + 2345; - }); - var buf = db.get(2000); - db.size.should.eql(3345); - buf.length.should.eql(2000); - }); - it('doesnt grow the pool if theres enough room available', function() { - var db = new BufferPool(1000); - var buf = db.get(1000); - db.size.should.eql(1000); - buf.length.should.eql(1000); - }); - }); - describe('#reset', function() { - it('shinks the pool', function() { - var db = new BufferPool(1000); - var buf = db.get(2000); - db.reset(true); - db.size.should.eql(1000); - }); - it('shrinks the pool according to the shrinkStrategy', function() { - var db = new BufferPool(1000, function(db, length) { - return db.used + length; - }, function(db) { - return 0; - }); - var buf = db.get(2000); - db.reset(true); - db.size.should.eql(0); - }); - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Receiver.hixie.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Receiver.hixie.test.js deleted file mode 100644 index 043d3bc4..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Receiver.hixie.test.js +++ /dev/null @@ -1,158 +0,0 @@ -var assert = require('assert') - , expect = require('expect.js') - , Receiver = require('../lib/Receiver.hixie'); -require('./hybi-common'); - -describe('Receiver', function() { - it('can parse text message', function() { - var p = new Receiver(); - var packet = '00 48 65 6c 6c 6f ff'; - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal('Hello', data); - }; - - p.add(getBufferFromHexString(packet)); - expect(gotData).to.equal(true); - }); - - it('can parse multiple text messages', function() { - var p = new Receiver(); - var packet = '00 48 65 6c 6c 6f ff 00 48 65 6c 6c 6f ff'; - - var gotData = false; - var messages = []; - p.ontext = function(data) { - gotData = true; - messages.push(data); - }; - - p.add(getBufferFromHexString(packet)); - expect(gotData).to.equal(true); - for (var i = 0; i < 2; ++i) { - expect(messages[i]).to.equal('Hello'); - } - }); - - it('can parse empty message', function() { - var p = new Receiver(); - var packet = '00 ff'; - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal('', data); - }; - - p.add(getBufferFromHexString(packet)); - expect(gotData).to.equal(true); - }); - - it('can parse text messages delivered over multiple frames', function() { - var p = new Receiver(); - var packets = [ - '00 48', - '65 6c 6c', - '6f ff 00 48', - '65', - '6c 6c 6f', - 'ff' - ]; - - var gotData = false; - var messages = []; - p.ontext = function(data) { - gotData = true; - messages.push(data); - }; - - for (var i = 0; i < packets.length; ++i) { - p.add(getBufferFromHexString(packets[i])); - } - expect(gotData).to.equal(true); - for (var i = 0; i < 2; ++i) { - expect(messages[i]).to.equal('Hello'); - } - }); - - it('emits an error if a payload doesnt start with 0x00', function() { - var p = new Receiver(); - var packets = [ - '00 6c ff', - '00 6c ff ff', - 'ff 00 6c ff 00 6c ff', - '00', - '6c 6c 6f', - 'ff' - ]; - - var gotData = false; - var gotError = false; - var messages = []; - p.ontext = function(data) { - gotData = true; - messages.push(data); - }; - p.onerror = function(reason, code) { - gotError = code == true; - }; - - for (var i = 0; i < packets.length && !gotError; ++i) { - p.add(getBufferFromHexString(packets[i])); - } - expect(gotError).to.equal(true); - expect(messages[0]).to.equal('l'); - expect(messages[1]).to.equal('l'); - expect(messages.length).to.equal(2); - }); - - it('can parse close messages', function() { - var p = new Receiver(); - var packets = [ - 'ff 00' - ]; - - var gotClose = false; - var gotError = false; - p.onclose = function() { - gotClose = true; - }; - p.onerror = function(reason, code) { - gotError = code == true; - }; - - for (var i = 0; i < packets.length && !gotError; ++i) { - p.add(getBufferFromHexString(packets[i])); - } - expect(gotClose).to.equal(true); - expect(gotError).to.equal(false); - }); - - it('can parse binary messages delivered over multiple frames', function() { - var p = new Receiver(); - var packets = [ - '80 05 48', - '65 6c 6c', - '6f 80 80 05 48', - '65', - '6c 6c 6f' - ]; - - var gotData = false; - var messages = []; - p.ontext = function(data) { - gotData = true; - messages.push(data); - }; - - for (var i = 0; i < packets.length; ++i) { - p.add(getBufferFromHexString(packets[i])); - } - expect(gotData).to.equal(true); - for (var i = 0; i < 2; ++i) { - expect(messages[i]).to.equal('Hello'); - } - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Receiver.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Receiver.test.js deleted file mode 100644 index b0b5c0a4..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Receiver.test.js +++ /dev/null @@ -1,255 +0,0 @@ -var assert = require('assert') - , Receiver = require('../lib/Receiver'); -require('should'); -require('./hybi-common'); - -describe('Receiver', function() { - it('can parse unmasked text message', function() { - var p = new Receiver(); - var packet = '81 05 48 65 6c 6c 6f'; - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal('Hello', data); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse close message', function() { - var p = new Receiver(); - var packet = '88 00'; - - var gotClose = false; - p.onclose = function(data) { - gotClose = true; - }; - - p.add(getBufferFromHexString(packet)); - gotClose.should.be.ok; - }); - it('can parse masked text message', function() { - var p = new Receiver(); - var packet = '81 93 34 83 a8 68 01 b9 92 52 4f a1 c6 09 59 e6 8a 52 16 e6 cb 00 5b a1 d5'; - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal('5:::{"name":"echo"}', data); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse a masked text message longer than 125 bytes', function() { - var p = new Receiver(); - var message = 'A'; - for (var i = 0; i < 300; ++i) message += (i % 5).toString(); - var packet = '81 FE ' + pack(4, message.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal(message, data); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse a really long masked text message', function() { - var p = new Receiver(); - var message = 'A'; - for (var i = 0; i < 64*1024; ++i) message += (i % 5).toString(); - var packet = '81 FF ' + pack(16, message.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal(message, data); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse a fragmented masked text message of 300 bytes', function() { - var p = new Receiver(); - var message = 'A'; - for (var i = 0; i < 300; ++i) message += (i % 5).toString(); - var msgpiece1 = message.substr(0, 150); - var msgpiece2 = message.substr(150); - var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68')); - var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68')); - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal(message, data); - }; - - p.add(getBufferFromHexString(packet1)); - p.add(getBufferFromHexString(packet2)); - gotData.should.be.ok; - }); - it('can parse a ping message', function() { - var p = new Receiver(); - var message = 'Hello'; - var packet = '89 ' + getHybiLengthAsHexString(message.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); - - var gotPing = false; - p.onping = function(data) { - gotPing = true; - assert.equal(message, data); - }; - - p.add(getBufferFromHexString(packet)); - gotPing.should.be.ok; - }); - it('can parse a ping with no data', function() { - var p = new Receiver(); - var packet = '89 00'; - - var gotPing = false; - p.onping = function(data) { - gotPing = true; - }; - - p.add(getBufferFromHexString(packet)); - gotPing.should.be.ok; - }); - it('can parse a fragmented masked text message of 300 bytes with a ping in the middle', function() { - var p = new Receiver(); - var message = 'A'; - for (var i = 0; i < 300; ++i) message += (i % 5).toString(); - - var msgpiece1 = message.substr(0, 150); - var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68')); - - var pingMessage = 'Hello'; - var pingPacket = '89 ' + getHybiLengthAsHexString(pingMessage.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68')); - - var msgpiece2 = message.substr(150); - var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68')); - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal(message, data); - }; - var gotPing = false; - p.onping = function(data) { - gotPing = true; - assert.equal(pingMessage, data); - }; - - p.add(getBufferFromHexString(packet1)); - p.add(getBufferFromHexString(pingPacket)); - p.add(getBufferFromHexString(packet2)); - gotData.should.be.ok; - gotPing.should.be.ok; - }); - it('can parse a fragmented masked text message of 300 bytes with a ping in the middle, which is delievered over sevaral tcp packets', function() { - var p = new Receiver(); - var message = 'A'; - for (var i = 0; i < 300; ++i) message += (i % 5).toString(); - - var msgpiece1 = message.substr(0, 150); - var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68')); - - var pingMessage = 'Hello'; - var pingPacket = '89 ' + getHybiLengthAsHexString(pingMessage.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68')); - - var msgpiece2 = message.substr(150); - var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68')); - - var gotData = false; - p.ontext = function(data) { - gotData = true; - assert.equal(message, data); - }; - var gotPing = false; - p.onping = function(data) { - gotPing = true; - assert.equal(pingMessage, data); - }; - - var buffers = []; - buffers = buffers.concat(splitBuffer(getBufferFromHexString(packet1))); - buffers = buffers.concat(splitBuffer(getBufferFromHexString(pingPacket))); - buffers = buffers.concat(splitBuffer(getBufferFromHexString(packet2))); - for (var i = 0; i < buffers.length; ++i) { - p.add(buffers[i]); - } - gotData.should.be.ok; - gotPing.should.be.ok; - }); - it('can parse a 100 byte long masked binary message', function() { - var p = new Receiver(); - var length = 100; - var message = new Buffer(length); - for (var i = 0; i < length; ++i) message[i] = i % 256; - var originalMessage = getHexStringFromBuffer(message); - var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); - - var gotData = false; - p.onbinary = function(data) { - gotData = true; - assert.equal(originalMessage, getHexStringFromBuffer(data)); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse a 256 byte long masked binary message', function() { - var p = new Receiver(); - var length = 256; - var message = new Buffer(length); - for (var i = 0; i < length; ++i) message[i] = i % 256; - var originalMessage = getHexStringFromBuffer(message); - var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); - - var gotData = false; - p.onbinary = function(data) { - gotData = true; - assert.equal(originalMessage, getHexStringFromBuffer(data)); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse a 200kb long masked binary message', function() { - var p = new Receiver(); - var length = 200 * 1024; - var message = new Buffer(length); - for (var i = 0; i < length; ++i) message[i] = i % 256; - var originalMessage = getHexStringFromBuffer(message); - var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); - - var gotData = false; - p.onbinary = function(data) { - gotData = true; - assert.equal(originalMessage, getHexStringFromBuffer(data)); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); - it('can parse a 200kb long unmasked binary message', function() { - var p = new Receiver(); - var length = 200 * 1024; - var message = new Buffer(length); - for (var i = 0; i < length; ++i) message[i] = i % 256; - var originalMessage = getHexStringFromBuffer(message); - var packet = '82 ' + getHybiLengthAsHexString(length, false) + ' ' + getHexStringFromBuffer(message); - - var gotData = false; - p.onbinary = function(data) { - gotData = true; - assert.equal(originalMessage, getHexStringFromBuffer(data)); - }; - - p.add(getBufferFromHexString(packet)); - gotData.should.be.ok; - }); -}); - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.hixie.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.hixie.test.js deleted file mode 100644 index 783f8922..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.hixie.test.js +++ /dev/null @@ -1,134 +0,0 @@ -var assert = require('assert') - , Sender = require('../lib/Sender.hixie'); -require('should'); -require('./hybi-common'); - -describe('Sender', function() { - describe('#send', function() { - it('frames and sends a text message', function(done) { - var message = 'Hello world'; - var received; - var socket = { - write: function(data, encoding, cb) { - received = data; - process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.send(message, {}, function() { - received.toString('utf8').should.eql('\u0000' + message + '\ufffd'); - done(); - }); - }); - - it('frames and sends an empty message', function(done) { - var socket = { - write: function(data, encoding, cb) { - done(); - } - }; - var sender = new Sender(socket, {}); - sender.send('', {}, function() {}); - }); - - it('frames and sends a buffer', function(done) { - var received; - var socket = { - write: function(data, encoding, cb) { - received = data; - process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.send(new Buffer('foobar'), {}, function() { - received.toString('utf8').should.eql('\u0000foobar\ufffd'); - done(); - }); - }); - - it('frames and sends a binary message', function(done) { - var message = 'Hello world'; - var received; - var socket = { - write: function(data, encoding, cb) { - received = data; - process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.send(message, {binary: true}, function() { - received.toString('hex').should.eql( - // 0x80 0x0b H e l l o w o r l d - '800b48656c6c6f20776f726c64'); - done(); - }); - }); -/* - it('throws an exception for binary data', function(done) { - var socket = { - write: function(data, encoding, cb) { - process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.on('error', function() { - done(); - }); - sender.send(new Buffer(100), {binary: true}, function() {}); - }); -*/ - it('can fauxe stream data', function(done) { - var received = []; - var socket = { - write: function(data, encoding, cb) { - received.push(data); - process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.send(new Buffer('foobar'), { fin: false }, function() {}); - sender.send('bazbar', { fin: false }, function() {}); - sender.send(new Buffer('end'), { fin: true }, function() { - received[0].toString('utf8').should.eql('\u0000foobar'); - received[1].toString('utf8').should.eql('bazbar'); - received[2].toString('utf8').should.eql('end\ufffd'); - done(); - }); - }); - }); - - describe('#close', function() { - it('sends a hixie close frame', function(done) { - var received; - var socket = { - write: function(data, encoding, cb) { - received = data; - process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.close(null, null, null, function() { - received.toString('utf8').should.eql('\ufffd\u0000'); - done(); - }); - }); - - it('sends a message end marker if fauxe streaming has started, before hixie close frame', function(done) { - var received = []; - var socket = { - write: function(data, encoding, cb) { - received.push(data); - if (cb) process.nextTick(cb); - } - }; - var sender = new Sender(socket, {}); - sender.send(new Buffer('foobar'), { fin: false }, function() {}); - sender.close(null, null, null, function() { - received[0].toString('utf8').should.eql('\u0000foobar'); - received[1].toString('utf8').should.eql('\ufffd'); - received[2].toString('utf8').should.eql('\ufffd\u0000'); - done(); - }); - }); - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.test.js deleted file mode 100644 index 43b4864d..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.test.js +++ /dev/null @@ -1,24 +0,0 @@ -var Sender = require('../lib/Sender'); -require('should'); - -describe('Sender', function() { - describe('#frameAndSend', function() { - it('does not modify a masked binary buffer', function() { - var sender = new Sender({ write: function() {} }); - var buf = new Buffer([1, 2, 3, 4, 5]); - sender.frameAndSend(2, buf, true, true); - buf[0].should.eql(1); - buf[1].should.eql(2); - buf[2].should.eql(3); - buf[3].should.eql(4); - buf[4].should.eql(5); - }); - - it('does not modify a masked text buffer', function() { - var sender = new Sender({ write: function() {} }); - var text = 'hi there'; - sender.frameAndSend(1, text, true, true); - text.should.eql('hi there'); - }); - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Validation.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Validation.test.js deleted file mode 100644 index 37c33993..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Validation.test.js +++ /dev/null @@ -1,23 +0,0 @@ -var Validation = require('../lib/Validation').Validation; -require('should'); - -describe('Validation', function() { - describe('isValidUTF8', function() { - it('should return true for a valid utf8 string', function() { - var validBuffer = new Buffer('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque gravida mattis rhoncus. Donec iaculis, metus quis varius accumsan, erat mauris condimentum diam, et egestas erat enim ut ligula. Praesent sollicitudin tellus eget dolor euismod euismod. Nullam ac augue nec neque varius luctus. Curabitur elit mi, consequat ultricies adipiscing mollis, scelerisque in erat. Phasellus facilisis fermentum ullamcorper. Nulla et sem eu arcu pharetra pellentesque. Praesent consectetur tempor justo, vel iaculis dui ullamcorper sit amet. Integer tristique viverra ullamcorper. Vivamus laoreet, nulla eget suscipit eleifend, lacus lectus feugiat libero, non fermentum erat nisi at risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pulvinar dignissim tellus, eu dignissim lorem vulputate quis. Morbi ut pulvinar augue.'); - Validation.isValidUTF8(validBuffer).should.be.ok; - }); - it('should return false for an erroneous string', function() { - var invalidBuffer = new Buffer([0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0xed, 0xa0, 0x80, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64]); - Validation.isValidUTF8(invalidBuffer).should.not.be.ok; - }); - it('should return true for valid cases from the autobahn test suite', function() { - Validation.isValidUTF8(new Buffer('\xf0\x90\x80\x80')).should.be.ok; - Validation.isValidUTF8(new Buffer([0xf0, 0x90, 0x80, 0x80])).should.be.ok; - }); - it('should return false for erroneous autobahn strings', function() { - Validation.isValidUTF8(new Buffer([0xce, 0xba, 0xe1, 0xbd])).should.not.be.ok; - }); - }); -}); - diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.integration.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.integration.js deleted file mode 100644 index 51a7e3a9..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.integration.js +++ /dev/null @@ -1,42 +0,0 @@ -var assert = require('assert') - , WebSocket = require('../') - , server = require('./testserver'); - -var port = 20000; - -function getArrayBuffer(buf) { - var l = buf.length; - var arrayBuf = new ArrayBuffer(l); - for (var i = 0; i < l; ++i) { - arrayBuf[i] = buf[i]; - } - return arrayBuf; -} - -function areArraysEqual(x, y) { - if (x.length != y.length) return false; - for (var i = 0, l = x.length; i < l; ++i) { - if (x[i] !== y[i]) return false; - } - return true; -} - -describe('WebSocket', function() { - it('communicates successfully with echo service', function(done) { - var ws = new WebSocket('ws://echo.websocket.org', {protocolVersion: 8, origin: 'http://websocket.org'}); - var str = Date.now().toString(); - var dataReceived = false; - ws.on('open', function() { - ws.send(str, {mask: true}); - }); - ws.on('close', function() { - assert.equal(true, dataReceived); - done(); - }); - ws.on('message', function(data, flags) { - assert.equal(str, data); - ws.terminate(); - dataReceived = true; - }); - }); -}); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.test.js deleted file mode 100644 index 71859476..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.test.js +++ /dev/null @@ -1,1470 +0,0 @@ -var assert = require('assert') - , https = require('https') - , http = require('http') - , should = require('should') - , WebSocket = require('../') - , WebSocketServer = require('../').Server - , fs = require('fs') - , server = require('./testserver') - , crypto = require('crypto'); - -var port = 20000; - -function getArrayBuffer(buf) { - var l = buf.length; - var arrayBuf = new ArrayBuffer(l); - for (var i = 0; i < l; ++i) { - arrayBuf[i] = buf[i]; - } - return arrayBuf; -} - -function areArraysEqual(x, y) { - if (x.length != y.length) return false; - for (var i = 0, l = x.length; i < l; ++i) { - if (x[i] !== y[i]) return false; - } - return true; -} - -describe('WebSocket', function() { - describe('#ctor', function() { - it('throws exception for invalid url', function(done) { - try { - var ws = new WebSocket('echo.websocket.org'); - } - catch (e) { - done(); - } - }); - }); - - describe('properties', function() { - it('#bytesReceived exposes number of bytes received', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('message', function() { - ws.bytesReceived.should.eql(8); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - ws.send('foobar'); - }); - }); - - it('#url exposes the server url', function(done) { - server.createServer(++port, function(srv) { - var url = 'ws://localhost:' + port; - var ws = new WebSocket(url); - assert.equal(url, ws.url); - ws.terminate(); - ws.on('close', function() { - srv.close(); - done(); - }); - }); - }); - - it('#protocolVersion exposes the protocol version', function(done) { - server.createServer(++port, function(srv) { - var url = 'ws://localhost:' + port; - var ws = new WebSocket(url); - assert.equal(13, ws.protocolVersion); - ws.terminate(); - ws.on('close', function() { - srv.close(); - done(); - }); - }); - }); - - describe('#readyState', function() { - it('defaults to connecting', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - assert.equal(WebSocket.CONNECTING, ws.readyState); - ws.terminate(); - ws.on('close', function() { - srv.close(); - done(); - }); - }); - }); - - it('set to open once connection is established', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - assert.equal(WebSocket.OPEN, ws.readyState); - srv.close(); - done(); - }); - }); - }); - - it('set to closed once connection is closed', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.close(1001); - ws.on('close', function() { - assert.equal(WebSocket.CLOSED, ws.readyState); - srv.close(); - done(); - }); - }); - }); - - it('set to closed once connection is terminated', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.terminate(); - ws.on('close', function() { - assert.equal(WebSocket.CLOSED, ws.readyState); - srv.close(); - done(); - }); - }); - }); - }); - - /* - * Ready state constants - */ - - var readyStates = { - CONNECTING: 0, - OPEN: 1, - CLOSING: 2, - CLOSED: 3 - }; - - /* - * Ready state constant tests - */ - - Object.keys(readyStates).forEach(function(state) { - describe('.' + state, function() { - it('is enumerable property', function() { - var propertyDescripter = Object.getOwnPropertyDescriptor(WebSocket, state) - assert.equal(readyStates[state], propertyDescripter.value); - assert.equal(true, propertyDescripter.enumerable); - }); - }); - }); - }); - - describe('events', function() { - it('emits a ping event', function(done) { - var wss = new WebSocketServer({port: ++port}); - wss.on('connection', function(client) { - client.ping(); - }); - var ws = new WebSocket('ws://localhost:' + port); - ws.on('ping', function() { - ws.terminate(); - wss.close(); - done(); - }); - }); - - it('emits a pong event', function(done) { - var wss = new WebSocketServer({port: ++port}); - wss.on('connection', function(client) { - client.pong(); - }); - var ws = new WebSocket('ws://localhost:' + port); - ws.on('pong', function() { - ws.terminate(); - wss.close(); - done(); - }); - }); - }); - - describe('connection establishing', function() { - it('can disconnect before connection is established', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.terminate(); - ws.on('open', function() { - assert.fail('connect shouldnt be raised here'); - }); - ws.on('close', function() { - srv.close(); - done(); - }); - }); - }); - - it('can close before connection is established', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.close(1001); - ws.on('open', function() { - assert.fail('connect shouldnt be raised here'); - }); - ws.on('close', function() { - srv.close(); - done(); - }); - }); - }); - - it('invalid server key is denied', function(done) { - server.createServer(++port, server.handlers.invalidKey, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() { - srv.close(); - done(); - }); - }); - }); - - it('close event is raised when server closes connection', function(done) { - server.createServer(++port, server.handlers.closeAfterConnect, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('close', function() { - srv.close(); - done(); - }); - }); - }); - - it('error is emitted if server aborts connection', function(done) { - server.createServer(++port, server.handlers.return401, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - assert.fail('connect shouldnt be raised here'); - }); - ws.on('error', function() { - srv.close(); - done(); - }); - }); - }); - }); - - describe('#pause and #resume', function() { - it('pauses the underlying stream', function(done) { - // this test is sort-of racecondition'y, since an unlikely slow connection - // to localhost can cause the test to succeed even when the stream pausing - // isn't working as intended. that is an extremely unlikely scenario, though - // and an acceptable risk for the test. - var client; - var serverClient; - var openCount = 0; - function onOpen() { - if (++openCount == 2) { - var paused = true; - serverClient.on('message', function() { - paused.should.not.be.ok; - wss.close(); - done(); - }); - serverClient.pause(); - setTimeout(function() { - paused = false; - serverClient.resume(); - }, 200); - client.send('foo'); - } - } - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - serverClient = ws; - serverClient.on('open', onOpen); - }); - wss.on('connection', function(ws) { - client = ws; - onOpen(); - }); - }); - }); - - describe('#ping', function() { - it('before connect should fail', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - try { - ws.ping(); - } - catch (e) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - - it('before connect can silently fail', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - ws.ping('', {}, true); - srv.close(); - ws.terminate(); - done(); - }); - }); - - it('without message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.ping(); - }); - srv.on('ping', function(message) { - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.ping('hi'); - }); - srv.on('ping', function(message) { - assert.equal('hi', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with encoded message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.ping('hi', {mask: true}); - }); - srv.on('ping', function(message, flags) { - assert.ok(flags.masked); - assert.equal('hi', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - }); - - describe('#pong', function() { - it('before connect should fail', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - try { - ws.pong(); - } - catch (e) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - - it('before connect can silently fail', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - ws.pong('', {}, true); - srv.close(); - ws.terminate(); - done(); - }); - }); - - it('without message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.pong(); - }); - srv.on('pong', function(message) { - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.pong('hi'); - }); - srv.on('pong', function(message) { - assert.equal('hi', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with encoded message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.pong('hi', {mask: true}); - }); - srv.on('pong', function(message, flags) { - assert.ok(flags.masked); - assert.equal('hi', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - }); - - describe('#send', function() { - it('very long binary data can be sent and received (with echoing server)', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var array = new Float32Array(5 * 1024 * 1024); - for (var i = 0; i < array.length; ++i) array[i] = i / 5; - ws.on('open', function() { - ws.send(array, {binary: true}); - }); - ws.on('message', function(message, flags) { - assert.ok(flags.binary); - assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('can send and receive text data', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.send('hi'); - }); - ws.on('message', function(message, flags) { - assert.equal('hi', message); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('send and receive binary data as an array', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var array = new Float32Array(5); - for (var i = 0; i < array.length; ++i) array[i] = i / 2; - ws.on('open', function() { - ws.send(array, {binary: true}); - }); - ws.on('message', function(message, flags) { - assert.ok(flags.binary); - assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('binary data can be sent and received as buffer', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var buf = new Buffer('foobar'); - ws.on('open', function() { - ws.send(buf, {binary: true}); - }); - ws.on('message', function(message, flags) { - assert.ok(flags.binary); - assert.ok(areArraysEqual(buf, message)); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('before connect should fail', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - try { - ws.send('hi'); - } - catch (e) { - ws.terminate(); - srv.close(); - done(); - } - }); - }); - - it('before connect should pass error through callback, if present', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - ws.send('hi', function(error) { - assert.ok(error instanceof Error); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('without data should be successful', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.send(); - }); - srv.on('message', function(message, flags) { - assert.equal('', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('calls optional callback when flushed', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.send('hi', function() { - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - }); - - it('with unencoded message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.send('hi'); - }); - srv.on('message', function(message, flags) { - assert.equal('hi', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with encoded message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.send('hi', {mask: true}); - }); - srv.on('message', function(message, flags) { - assert.ok(flags.masked); - assert.equal('hi', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with unencoded binary message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var array = new Float32Array(5); - for (var i = 0; i < array.length; ++i) array[i] = i / 2; - ws.on('open', function() { - ws.send(array, {binary: true}); - }); - srv.on('message', function(message, flags) { - assert.ok(flags.binary); - assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with encoded binary message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var array = new Float32Array(5); - for (var i = 0; i < array.length; ++i) array[i] = i / 2; - ws.on('open', function() { - ws.send(array, {mask: true, binary: true}); - }); - srv.on('message', function(message, flags) { - assert.ok(flags.binary); - assert.ok(flags.masked); - assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with binary stream will send fragmented data', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var callbackFired = false; - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.bufferSize = 100; - ws.send(fileStream, {binary: true}, function(error) { - assert.equal(null, error); - callbackFired = true; - }); - }); - srv.on('message', function(data, flags) { - assert.ok(flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile'), data)); - ws.terminate(); - }); - ws.on('close', function() { - assert.ok(callbackFired); - srv.close(); - done(); - }); - }); - }); - - it('with text stream will send fragmented data', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var callbackFired = false; - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream, {binary: false}, function(error) { - assert.equal(null, error); - callbackFired = true; - }); - }); - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); - ws.terminate(); - }); - ws.on('close', function() { - assert.ok(callbackFired); - srv.close(); - done(); - }); - }); - }); - - it('will cause intermittent send to be delayed in order', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream); - ws.send('foobar'); - ws.send('baz'); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - ++receivedIndex; - if (receivedIndex == 1) { - assert.ok(!flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); - } - else if (receivedIndex == 2) { - assert.ok(!flags.binary); - assert.equal('foobar', data); - } - else { - assert.ok(!flags.binary); - assert.equal('baz', data); - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent stream to be delayed in order', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream); - var i = 0; - ws.stream(function(error, send) { - assert.ok(!error); - if (++i == 1) send('foo'); - else send('bar', true); - }); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - ++receivedIndex; - if (receivedIndex == 1) { - assert.ok(!flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); - } - else if (receivedIndex == 2) { - assert.ok(!flags.binary); - assert.equal('foobar', data); - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent ping to be delivered', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream); - ws.ping('foobar'); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - srv.on('ping', function(data) { - assert.equal('foobar', data); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent pong to be delivered', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream); - ws.pong('foobar'); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - srv.on('pong', function(data) { - assert.equal('foobar', data); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent close to be delivered', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream); - ws.close(1000, 'foobar'); - }); - ws.on('close', function() { - srv.close(); - ws.terminate(); - done(); - }); - ws.on('error', function() { /* That's quite alright -- a send was attempted after close */ }); - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); - }); - srv.on('close', function(code, data) { - assert.equal(1000, code); - assert.equal('foobar', data); - }); - }); - }); - }); - - describe('#stream', function() { - it('very long binary data can be streamed', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var buffer = new Buffer(10 * 1024); - for (var i = 0; i < buffer.length; ++i) buffer[i] = i % 0xff; - ws.on('open', function() { - var i = 0; - var blockSize = 800; - var bufLen = buffer.length; - ws.stream({binary: true}, function(error, send) { - assert.ok(!error); - var start = i * blockSize; - var toSend = Math.min(blockSize, bufLen - (i * blockSize)); - var end = start + toSend; - var isFinal = toSend < blockSize; - send(buffer.slice(start, end), isFinal); - i += 1; - }); - }); - srv.on('message', function(data, flags) { - assert.ok(flags.binary); - assert.ok(areArraysEqual(buffer, data)); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('before connect should pass error through callback', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() {}); - ws.stream(function(error) { - assert.ok(error instanceof Error); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('without callback should fail', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var payload = 'HelloWorld'; - ws.on('open', function() { - try { - ws.stream(); - } - catch (e) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent send to be delayed in order', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var payload = 'HelloWorld'; - ws.on('open', function() { - var i = 0; - ws.stream(function(error, send) { - assert.ok(!error); - if (++i == 1) { - send(payload.substr(0, 5)); - ws.send('foobar'); - ws.send('baz'); - } - else { - send(payload.substr(5, 5), true); - } - }); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - ++receivedIndex; - if (receivedIndex == 1) { - assert.ok(!flags.binary); - assert.equal(payload, data); - } - else if (receivedIndex == 2) { - assert.ok(!flags.binary); - assert.equal('foobar', data); - } - else { - assert.ok(!flags.binary); - assert.equal('baz', data); - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent stream to be delayed in order', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var payload = 'HelloWorld'; - ws.on('open', function() { - var i = 0; - ws.stream(function(error, send) { - assert.ok(!error); - if (++i == 1) { - send(payload.substr(0, 5)); - var i2 = 0; - ws.stream(function(error, send) { - assert.ok(!error); - if (++i2 == 1) send('foo'); - else send('bar', true); - }); - ws.send('baz'); - } - else send(payload.substr(5, 5), true); - }); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - ++receivedIndex; - if (receivedIndex == 1) { - assert.ok(!flags.binary); - assert.equal(payload, data); - } - else if (receivedIndex == 2) { - assert.ok(!flags.binary); - assert.equal('foobar', data); - } - else if (receivedIndex == 3){ - assert.ok(!flags.binary); - assert.equal('baz', data); - setTimeout(function() { - srv.close(); - ws.terminate(); - done(); - }, 1000); - } - else throw new Error('more messages than we actually sent just arrived'); - }); - }); - }); - - it('will cause intermittent ping to be delivered', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var payload = 'HelloWorld'; - ws.on('open', function() { - var i = 0; - ws.stream(function(error, send) { - assert.ok(!error); - if (++i == 1) { - send(payload.substr(0, 5)); - ws.ping('foobar'); - } - else { - send(payload.substr(5, 5), true); - } - }); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.equal(payload, data); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - srv.on('ping', function(data) { - assert.equal('foobar', data); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent pong to be delivered', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var payload = 'HelloWorld'; - ws.on('open', function() { - var i = 0; - ws.stream(function(error, send) { - assert.ok(!error); - if (++i == 1) { - send(payload.substr(0, 5)); - ws.pong('foobar'); - } - else { - send(payload.substr(5, 5), true); - } - }); - }); - var receivedIndex = 0; - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.equal(payload, data); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - srv.on('pong', function(data) { - assert.equal('foobar', data); - if (++receivedIndex == 2) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('will cause intermittent close to be delivered', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var payload = 'HelloWorld'; - var errorGiven = false; - ws.on('open', function() { - var i = 0; - ws.stream(function(error, send) { - if (++i == 1) { - send(payload.substr(0, 5)); - ws.close(1000, 'foobar'); - } - else if(i == 2) { - send(payload.substr(5, 5), true); - } - else if (i == 3) { - assert.ok(error); - errorGiven = true; - } - }); - }); - ws.on('close', function() { - assert.ok(errorGiven); - srv.close(); - ws.terminate(); - done(); - }); - srv.on('message', function(data, flags) { - assert.ok(!flags.binary); - assert.equal(payload, data); - }); - srv.on('close', function(code, data) { - assert.equal(1000, code); - assert.equal('foobar', data); - }); - }); - }); - }); - - describe('#close', function() { - it('will raise error callback, if any, if called during send stream', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var errorGiven = false; - ws.on('open', function() { - var fileStream = fs.createReadStream('test/fixtures/textfile'); - fileStream.setEncoding('utf8'); - fileStream.bufferSize = 100; - ws.send(fileStream, function(error) { - errorGiven = error != null; - }); - ws.close(1000, 'foobar'); - }); - ws.on('close', function() { - setTimeout(function() { - assert.ok(errorGiven); - srv.close(); - ws.terminate(); - done(); - }, 1000); - }); - }); - }); - - it('without invalid first argument throws exception', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - try { - ws.close('error'); - } - catch (e) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('without reserved error code 1004 throws exception', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - try { - ws.close(1004); - } - catch (e) { - srv.close(); - ws.terminate(); - done(); - } - }); - }); - }); - - it('without message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.close(1000); - }); - srv.on('close', function(code, message, flags) { - assert.equal('', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.close(1000, 'some reason'); - }); - srv.on('close', function(code, message, flags) { - assert.ok(flags.masked); - assert.equal('some reason', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('with encoded message is successfully transmitted to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('open', function() { - ws.close(1000, 'some reason', {mask: true}); - }); - srv.on('close', function(code, message, flags) { - assert.ok(flags.masked); - assert.equal('some reason', message); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - - it('ends connection to the server', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var connectedOnce = false; - ws.on('open', function() { - connectedOnce = true; - ws.close(1000, 'some reason', {mask: true}); - }); - ws.on('close', function() { - assert.ok(connectedOnce); - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - }); - - describe('W3C API emulation', function() { - it('should not throw errors when getting and setting', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var listener = function () {}; - - ws.onmessage = listener; - ws.onerror = listener; - ws.onclose = listener; - ws.onopen = listener; - - assert.ok(ws.onopen === listener); - assert.ok(ws.onmessage === listener); - assert.ok(ws.onclose === listener); - assert.ok(ws.onerror === listener); - - srv.close(); - ws.terminate(); - done(); - }); - }); - - it('should work the same as the EventEmitter api', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - var listener = function() {}; - var message = 0; - var close = 0; - var open = 0; - - ws.onmessage = function(messageEvent) { - assert.ok(!!messageEvent.data); - ++message; - ws.close(); - }; - - ws.onopen = function() { - ++open; - } - - ws.onclose = function() { - ++close; - } - - ws.on('open', function() { - ws.send('foo'); - }); - - ws.on('close', function() { - process.nextTick(function() { - assert.ok(message === 1); - assert.ok(open === 1); - assert.ok(close === 1); - - srv.close(); - ws.terminate(); - done(); - }); - }); - }); - }); - - it('should receive text data wrapped in a MessageEvent when using addEventListener', function(done) { - server.createServer(++port, function(srv) { - var ws = new WebSocket('ws://localhost:' + port); - ws.addEventListener('open', function() { - ws.send('hi'); - }); - ws.addEventListener('message', function(messageEvent) { - assert.equal('hi', messageEvent.data); - ws.terminate(); - srv.close(); - done(); - }); - }); - }); - - it('should receive valid CloseEvent when server closes with code 1000', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - ws.addEventListener('close', function(closeEvent) { - assert.equal(true, closeEvent.wasClean); - assert.equal(1000, closeEvent.code); - ws.terminate(); - wss.close(); - done(); - }); - }); - wss.on('connection', function(client) { - client.close(1000); - }); - }); - - it('should receive vaild CloseEvent when server closes with code 1001', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - ws.addEventListener('close', function(closeEvent) { - assert.equal(false, closeEvent.wasClean); - assert.equal(1001, closeEvent.code); - assert.equal('some daft reason', closeEvent.reason); - ws.terminate(); - wss.close(); - done(); - }); - }); - wss.on('connection', function(client) { - client.close(1001, 'some daft reason'); - }); - }); - }); - - describe('ssl', function() { - it('can connect to secure websocket server', function(done) { - var options = { - key: fs.readFileSync('test/fixtures/key.pem'), - cert: fs.readFileSync('test/fixtures/certificate.pem') - }; - var app = https.createServer(options, function (req, res) { - res.writeHead(200); - res.end(); - }); - var wss = new WebSocketServer({server: app}); - app.listen(++port, function() { - var ws = new WebSocket('wss://localhost:' + port); - }); - wss.on('connection', function(ws) { - app.close(); - ws.terminate(); - wss.close(); - done(); - }); - }); - - it('cannot connect to secure websocket server via ws://', function(done) { - var options = { - key: fs.readFileSync('test/fixtures/key.pem'), - cert: fs.readFileSync('test/fixtures/certificate.pem') - }; - var app = https.createServer(options, function (req, res) { - res.writeHead(200); - res.end(); - }); - var wss = new WebSocketServer({server: app}); - app.listen(++port, function() { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('error', function() { - app.close(); - ws.terminate(); - wss.close(); - done(); - }); - }); - }); - - it('can send and receive text data', function(done) { - var options = { - key: fs.readFileSync('test/fixtures/key.pem'), - cert: fs.readFileSync('test/fixtures/certificate.pem') - }; - var app = https.createServer(options, function (req, res) { - res.writeHead(200); - res.end(); - }); - var wss = new WebSocketServer({server: app}); - app.listen(++port, function() { - var ws = new WebSocket('wss://localhost:' + port); - ws.on('open', function() { - ws.send('foobar'); - }); - }); - wss.on('connection', function(ws) { - ws.on('message', function(message, flags) { - message.should.eql('foobar'); - app.close(); - ws.terminate(); - wss.close(); - done(); - }); - }); - }); - - it('can send and receive very long binary data', function(done) { - var options = { - key: fs.readFileSync('test/fixtures/key.pem'), - cert: fs.readFileSync('test/fixtures/certificate.pem') - } - var app = https.createServer(options, function (req, res) { - res.writeHead(200); - res.end(); - }); - crypto.randomBytes(5 * 1024 * 1024, function(ex, buf) { - if (ex) throw ex; - var wss = new WebSocketServer({server: app}); - app.listen(++port, function() { - var ws = new WebSocket('wss://localhost:' + port); - ws.on('open', function() { - ws.send(buf, {binary: true}); - }); - ws.on('message', function(message, flags) { - flags.binary.should.be.ok; - areArraysEqual(buf, message).should.be.ok; - app.close(); - ws.terminate(); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - ws.on('message', function(message, flags) { - ws.send(message, {binary: true}); - }); - }); - }); - }); - }); - - describe('protocol support discovery', function() { - describe('#supports', function() { - describe('#binary', function() { - it('returns true for hybi transport', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(client) { - assert.equal(true, client.supports.binary); - wss.close(); - done(); - }); - }); - - it('returns false for hixie transport', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - }); - wss.on('connection', function(client) { - assert.equal(false, client.supports.binary); - wss.close(); - done(); - }); - }); - }); - }); - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocketServer.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocketServer.test.js deleted file mode 100644 index c267b0f2..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocketServer.test.js +++ /dev/null @@ -1,1011 +0,0 @@ -var http = require('http') - , https = require('https') - , WebSocket = require('../') - , WebSocketServer = WebSocket.Server - , fs = require('fs') - , should = require('should'); - -var port = 20000; - -function getArrayBuffer(buf) { - var l = buf.length; - var arrayBuf = new ArrayBuffer(l); - for (var i = 0; i < l; ++i) { - arrayBuf[i] = buf[i]; - } - return arrayBuf; -} - -function areArraysEqual(x, y) { - if (x.length != y.length) return false; - for (var i = 0, l = x.length; i < l; ++i) { - if (x[i] !== y[i]) return false; - } - return true; -} - -describe('WebSocketServer', function() { - describe('#ctor', function() { - it('throws an error if no option object is passed', function() { - var gotException = false; - try { - var wss = new WebSocketServer(); - } - catch (e) { - gotException = true; - } - gotException.should.be.ok; - }); - - it('throws an error if no port or server is specified', function() { - var gotException = false; - try { - var wss = new WebSocketServer({}); - } - catch (e) { - gotException = true; - } - gotException.should.be.ok; - }); - - it('does not throw an error if no port or server is specified, when the noServer option is true', function() { - var gotException = false; - try { - var wss = new WebSocketServer({noServer: true}); - } - catch (e) { - gotException = true; - } - gotException.should.eql(false); - }); - - it('emits an error if http server bind fails', function(done) { - var wss = new WebSocketServer({port: 1}); - wss.on('error', function() { done(); }); - }); - - it('starts a server on a given port', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(client) { - wss.close(); - done(); - }); - }); - - it('uses a precreated http server', function (done) { - var srv = http.createServer(); - srv.listen(++port, function () { - var wss = new WebSocketServer({server: srv}); - var ws = new WebSocket('ws://localhost:' + port); - - wss.on('connection', function(client) { - wss.close(); - srv.close(); - done(); - }); - }); - }); - - it('uses a precreated http server listening on unix socket', function (done) { - var srv = http.createServer(); - var sockPath = '/tmp/ws_socket_'+new Date().getTime()+'.'+Math.floor(Math.random() * 1000); - srv.listen(sockPath, function () { - var wss = new WebSocketServer({server: srv}); - var ws = new WebSocket('ws+unix://'+sockPath); - - wss.on('connection', function(client) { - wss.close(); - srv.close(); - done(); - }); - }); - }); - - it('emits path specific connection event', function (done) { - var srv = http.createServer(); - srv.listen(++port, function () { - var wss = new WebSocketServer({server: srv}); - var ws = new WebSocket('ws://localhost:' + port+'/endpointName'); - - wss.on('connection/endpointName', function(client) { - wss.close(); - srv.close(); - done(); - }); - }); - }); - - it('can have two different instances listening on the same http server with two different paths', function(done) { - var srv = http.createServer(); - srv.listen(++port, function () { - var wss1 = new WebSocketServer({server: srv, path: '/wss1'}) - , wss2 = new WebSocketServer({server: srv, path: '/wss2'}); - var doneCount = 0; - wss1.on('connection', function(client) { - wss1.close(); - if (++doneCount == 2) { - srv.close(); - done(); - } - }); - wss2.on('connection', function(client) { - wss2.close(); - if (++doneCount == 2) { - srv.close(); - done(); - } - }); - var ws1 = new WebSocket('ws://localhost:' + port + '/wss1'); - var ws2 = new WebSocket('ws://localhost:' + port + '/wss2?foo=1'); - }); - }); - - it('cannot have two different instances listening on the same http server with the same path', function(done) { - var srv = http.createServer(); - srv.listen(++port, function () { - var wss1 = new WebSocketServer({server: srv, path: '/wss1'}); - try { - var wss2 = new WebSocketServer({server: srv, path: '/wss1'}); - } - catch (e) { - wss1.close(); - srv.close(); - done(); - } - }); - }); - }); - - describe('#close', function() { - it('will close all clients', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('close', function() { - if (++closes == 2) done(); - }); - }); - var closes = 0; - wss.on('connection', function(client) { - client.on('close', function() { - if (++closes == 2) done(); - }); - wss.close(); - }); - }); - - it('does not close a precreated server', function(done) { - var srv = http.createServer(); - var realClose = srv.close; - srv.close = function() { - should.fail('must not close pre-created server'); - } - srv.listen(++port, function () { - var wss = new WebSocketServer({server: srv}); - var ws = new WebSocket('ws://localhost:' + port); - wss.on('connection', function(client) { - wss.close(); - srv.close = realClose; - srv.close(); - done(); - }); - }); - }); - - it('cleans up websocket data on a precreated server', function(done) { - var srv = http.createServer(); - srv.listen(++port, function () { - var wss1 = new WebSocketServer({server: srv, path: '/wss1'}) - , wss2 = new WebSocketServer({server: srv, path: '/wss2'}); - (typeof srv._webSocketPaths).should.eql('object'); - Object.keys(srv._webSocketPaths).length.should.eql(2); - wss1.close(); - Object.keys(srv._webSocketPaths).length.should.eql(1); - wss2.close(); - (typeof srv._webSocketPaths).should.eql('undefined'); - srv.close(); - done(); - }); - }); - }); - - describe('#clients', function() { - it('returns a list of connected clients', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - wss.clients.length.should.eql(0); - var ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(client) { - wss.clients.length.should.eql(1); - wss.close(); - done(); - }); - }); - - it('can be disabled', function(done) { - var wss = new WebSocketServer({port: ++port, clientTracking: false}, function() { - wss.clients.length.should.eql(0); - var ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(client) { - wss.clients.length.should.eql(0); - wss.close(); - done(); - }); - }); - - it('is updated when client terminates the connection', function(done) { - var ws; - var wss = new WebSocketServer({port: ++port}, function() { - ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(client) { - client.on('close', function() { - wss.clients.length.should.eql(0); - wss.close(); - done(); - }); - ws.terminate(); - }); - }); - - it('is updated when client closes the connection', function(done) { - var ws; - var wss = new WebSocketServer({port: ++port}, function() { - ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(client) { - client.on('close', function() { - wss.clients.length.should.eql(0); - wss.close(); - done(); - }); - ws.close(); - }); - }); - }); - - describe('#options', function() { - it('exposes options passed to constructor', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - wss.options.port.should.eql(port); - wss.close(); - done(); - }); - }); - }); - - describe('#handleUpgrade', function() { - it('can be used for a pre-existing server', function (done) { - var srv = http.createServer(); - srv.listen(++port, function () { - var wss = new WebSocketServer({noServer: true}); - srv.on('upgrade', function(req, socket, upgradeHead) { - wss.handleUpgrade(req, socket, upgradeHead, function(client) { - client.send('hello'); - }); - }); - var ws = new WebSocket('ws://localhost:' + port); - ws.on('message', function(message) { - message.should.eql('hello'); - wss.close(); - srv.close(); - done(); - }); - }); - }); - }); - - describe('hybi mode', function() { - describe('connection establishing', function() { - it('does not accept connections with no sec-websocket-key', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(400); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('does not accept connections with no sec-websocket-version', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(400); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('does not accept connections with invalid sec-websocket-version', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 12 - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(400); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('client can be denied', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { - return false; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 8, - 'Sec-WebSocket-Origin': 'http://foobar.com' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(401); - process.nextTick(function() { - wss.close(); - done(); - }); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('client can be accepted', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { - return true; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 13, - 'Origin': 'http://foobar.com' - } - }; - var req = http.request(options); - req.end(); - }); - wss.on('connection', function(ws) { - ws.terminate(); - wss.close(); - done(); - }); - wss.on('error', function() {}); - }); - - it('verifyClient gets client origin', function(done) { - var verifyClientCalled = false; - var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { - info.origin.should.eql('http://foobarbaz.com'); - verifyClientCalled = true; - return false; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 13, - 'Origin': 'http://foobarbaz.com' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - verifyClientCalled.should.be.ok; - wss.close(); - done(); - }); - }); - wss.on('error', function() {}); - }); - - it('verifyClient gets original request', function(done) { - var verifyClientCalled = false; - var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { - info.req.headers['sec-websocket-key'].should.eql('dGhlIHNhbXBsZSBub25jZQ=='); - verifyClientCalled = true; - return false; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 13, - 'Origin': 'http://foobarbaz.com' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - verifyClientCalled.should.be.ok; - wss.close(); - done(); - }); - }); - wss.on('error', function() {}); - }); - - it('verifyClient has secure:true for ssl connections', function(done) { - var options = { - key: fs.readFileSync('test/fixtures/key.pem'), - cert: fs.readFileSync('test/fixtures/certificate.pem') - }; - var app = https.createServer(options, function (req, res) { - res.writeHead(200); - res.end(); - }); - var success = false; - var wss = new WebSocketServer({ - server: app, - verifyClient: function(info) { - success = info.secure === true; - return true; - } - }); - app.listen(++port, function() { - var ws = new WebSocket('wss://localhost:' + port); - }); - wss.on('connection', function(ws) { - app.close(); - ws.terminate(); - wss.close(); - success.should.be.ok; - done(); - }); - }); - - it('verifyClient has secure:false for non-ssl connections', function(done) { - var app = http.createServer(function (req, res) { - res.writeHead(200); - res.end(); - }); - var success = false; - var wss = new WebSocketServer({ - server: app, - verifyClient: function(info) { - success = info.secure === false; - return true; - } - }); - app.listen(++port, function() { - var ws = new WebSocket('ws://localhost:' + port); - }); - wss.on('connection', function(ws) { - app.close(); - ws.terminate(); - wss.close(); - success.should.be.ok; - done(); - }); - }); - - it('client can be denied asynchronously', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { - process.nextTick(function() { - cb(false); - }); - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 8, - 'Sec-WebSocket-Origin': 'http://foobar.com' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(401); - process.nextTick(function() { - wss.close(); - done(); - }); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('client can be accepted asynchronously', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { - process.nextTick(function() { - cb(true); - }); - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 13, - 'Origin': 'http://foobar.com' - } - }; - var req = http.request(options); - req.end(); - }); - wss.on('connection', function(ws) { - ws.terminate(); - wss.close(); - done(); - }); - wss.on('error', function() {}); - }); - - it('handles messages passed along with the upgrade request (upgrade head)', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { - return true; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', - 'Sec-WebSocket-Version': 13, - 'Origin': 'http://foobar.com' - } - }; - var req = http.request(options); - req.write(new Buffer([0x81, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f], 'binary')); - req.end(); - }); - wss.on('connection', function(ws) { - ws.on('message', function(data) { - data.should.eql('Hello'); - ws.terminate(); - wss.close(); - done(); - }); - }); - wss.on('error', function() {}); - }); - }); - - describe('messaging', function() { - it('can send and receive data', function(done) { - var data = new Array(65*1024); - for (var i = 0; i < data.length; ++i) { - data[i] = String.fromCharCode(65 + ~~(25 * Math.random())); - } - data = data.join(''); - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port); - ws.on('message', function(message, flags) { - ws.send(message); - }); - }); - wss.on('connection', function(client) { - client.on('message', function(message) { - message.should.eql(data); - wss.close(); - done(); - }); - client.send(data); - }); - }); - }); - }); - - describe('hixie mode', function() { - it('can be disabled', function(done) { - var wss = new WebSocketServer({port: ++port, disableHixie: true}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(401); - process.nextTick(function() { - wss.close(); - done(); - }); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - describe('connection establishing', function() { - it('does not accept connections with no sec-websocket-key1', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(400); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('does not accept connections with no sec-websocket-key2', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(400); - wss.close(); - done(); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('accepts connections with valid handshake', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - }); - wss.on('connection', function(ws) { - ws.terminate(); - wss.close(); - done(); - }); - wss.on('error', function() {}); - }); - - it('client can be denied', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { - return false; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(401); - process.nextTick(function() { - wss.close(); - done(); - }); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('client can be accepted', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { - return true; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - }); - wss.on('connection', function(ws) { - ws.terminate(); - wss.close(); - done(); - }); - wss.on('error', function() {}); - }); - - it('verifyClient gets client origin', function(done) { - var verifyClientCalled = false; - var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { - info.origin.should.eql('http://foobarbaz.com'); - verifyClientCalled = true; - return false; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Origin': 'http://foobarbaz.com', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - req.on('response', function(res) { - verifyClientCalled.should.be.ok; - wss.close(); - done(); - }); - }); - wss.on('error', function() {}); - }); - - it('verifyClient gets original request', function(done) { - var verifyClientCalled = false; - var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { - info.req.headers['sec-websocket-key1'].should.eql('3e6b263 4 17 80'); - verifyClientCalled = true; - return false; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Origin': 'http://foobarbaz.com', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - req.on('response', function(res) { - verifyClientCalled.should.be.ok; - wss.close(); - done(); - }); - }); - wss.on('error', function() {}); - }); - - it('client can be denied asynchronously', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { - cb(false); - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Origin': 'http://foobarbaz.com', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - req.on('response', function(res) { - res.statusCode.should.eql(401); - process.nextTick(function() { - wss.close(); - done(); - }); - }); - }); - wss.on('connection', function(ws) { - done(new Error('connection must not be established')); - }); - wss.on('error', function() {}); - }); - - it('client can be accepted asynchronously', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { - cb(true); - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Origin': 'http://foobarbaz.com', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.end(); - }); - wss.on('connection', function(ws) { - wss.close(); - done(); - }); - wss.on('error', function() {}); - }); - - it('handles messages passed along with the upgrade request (upgrade head)', function(done) { - var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { - return true; - }}, function() { - var options = { - port: port, - host: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'WebSocket', - 'Sec-WebSocket-Key1': '3e6b263 4 17 80', - 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90', - 'Origin': 'http://foobar.com' - } - }; - var req = http.request(options); - req.write('WjN}|M(6'); - req.write(new Buffer([0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xff], 'binary')); - req.end(); - }); - wss.on('connection', function(ws) { - ws.on('message', function(data) { - data.should.eql('Hello'); - ws.terminate(); - wss.close(); - done(); - }); - }); - wss.on('error', function() {}); - }); - }); - }); - - describe('client properties', function() { - it('protocol is exposed', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port, {protocol: 'hi'}); - }); - wss.on('connection', function(client) { - client.protocol.should.eql('hi'); - wss.close(); - done(); - }); - }); - - it('protocolVersion is exposed', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port, {protocolVersion: 8}); - }); - wss.on('connection', function(client) { - client.protocolVersion.should.eql(8); - wss.close(); - done(); - }); - }); - - it('upgradeReq is the original request object', function(done) { - var wss = new WebSocketServer({port: ++port}, function() { - var ws = new WebSocket('ws://localhost:' + port, {protocolVersion: 8}); - }); - wss.on('connection', function(client) { - client.upgradeReq.httpVersion.should.eql('1.1'); - wss.close(); - done(); - }); - }); - }); - -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/autobahn-server.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/autobahn-server.js deleted file mode 100644 index 36fe0c24..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/autobahn-server.js +++ /dev/null @@ -1,29 +0,0 @@ -var WebSocketServer = require('../').Server; - -process.on('uncaughtException', function(err) { - console.log('Caught exception: ', err, err.stack); -}); - -process.on('SIGINT', function () { - try { - console.log('Updating reports and shutting down'); - var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); - ws.on('close', function() { - process.exit(); - }); - } - catch(e) { - process.exit(); - } -}); - -var wss = new WebSocketServer({port: 8181}); -wss.on('connection', function(ws) { - console.log('new connection'); - ws.on('message', function(data, flags) { - ws.send(flags.buffer, {binary: flags.binary === true}); - }); - ws.on('error', function() { - console.log('error', arguments); - }); -}); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/autobahn.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/autobahn.js deleted file mode 100644 index 048cc904..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/autobahn.js +++ /dev/null @@ -1,52 +0,0 @@ -var WebSocket = require('../'); -var currentTest = 1; -var lastTest = -1; -var testCount = null; - -process.on('uncaughtException', function(err) { - console.log('Caught exception: ', err, err.stack); -}); - -process.on('SIGINT', function () { - try { - console.log('Updating reports and shutting down'); - var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); - ws.on('close', function() { - process.exit(); - }); - } - catch(e) { - process.exit(); - } -}); - -function nextTest() { - if (currentTest > testCount || (lastTest != -1 && currentTest > lastTest)) { - console.log('Updating reports and shutting down'); - var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); - ws.on('close', function() { - process.exit(); - }); - return; - }; - console.log('Running test case ' + currentTest + '/' + testCount); - var ws = new WebSocket('ws://localhost:9001/runCase?case=' + currentTest + '&agent=ws'); - ws.on('message', function(data, flags) { - ws.send(flags.buffer, {binary: flags.binary === true, mask: true}); - }); - ws.on('close', function(data) { - currentTest += 1; - process.nextTick(nextTest); - }); - ws.on('error', function(e) {}); -} - -var ws = new WebSocket('ws://localhost:9001/getCaseCount'); -ws.on('message', function(data, flags) { - testCount = parseInt(data); -}); -ws.on('close', function() { - if (testCount > 0) { - nextTest(); - } -}); \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/certificate.pem b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/certificate.pem deleted file mode 100644 index 0efc2ef5..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/certificate.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICATCCAWoCCQDPufXH86n2QzANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJu -bzETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 -cyBQdHkgTHRkMB4XDTEyMDEwMTE0NDQwMFoXDTIwMDMxOTE0NDQwMFowRTELMAkG -A1UEBhMCbm8xEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0 -IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtrQ7 -+r//2iV/B6F+4boH0XqFn7alcV9lpjvAmwRXNKnxAoa0f97AjYPGNLKrjpkNXXhB -JROIdbRbZnCNeC5fzX1a+JCo7KStzBXuGSZr27TtFmcV4H+9gIRIcNHtZmJLnxbJ -sIhkGR8yVYdmJZe4eT5ldk1zoB1adgPF1hZhCBMCAwEAATANBgkqhkiG9w0BAQUF -AAOBgQCeWBEHYJ4mCB5McwSSUox0T+/mJ4W48L/ZUE4LtRhHasU9hiW92xZkTa7E -QLcoJKQiWfiLX2ysAro0NX4+V8iqLziMqvswnPzz5nezaOLE/9U/QvH3l8qqNkXu -rNbsW1h/IO6FV8avWFYVFoutUwOaZ809k7iMh2F2JMgXQ5EymQ== ------END CERTIFICATE----- diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/key.pem b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/key.pem deleted file mode 100644 index 176fe320..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/key.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEChrR/ -3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0WZxXg -f72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwIDAQAB -AoGAAlVY8sHi/aE+9xT77twWX3mGHV0SzdjfDnly40fx6S1Gc7bOtVdd9DC7pk6l -3ENeJVR02IlgU8iC5lMHq4JEHPE272jtPrLlrpWLTGmHEqoVFv9AITPqUDLhB9Kk -Hjl7h8NYBKbr2JHKICr3DIPKOT+RnXVb1PD4EORbJ3ooYmkCQQDfknUnVxPgxUGs -ouABw1WJIOVgcCY/IFt4Ihf6VWTsxBgzTJKxn3HtgvE0oqTH7V480XoH0QxHhjLq -DrgobWU9AkEA0TRJ8/ouXGnFEPAXjWr9GdPQRZ1Use2MrFjneH2+Sxc0CmYtwwqL -Kr5kS6mqJrxprJeluSjBd+3/ElxURrEXjwJAUvmlN1OPEhXDmRHd92mKnlkyKEeX -OkiFCiIFKih1S5Y/sRJTQ0781nyJjtJqO7UyC3pnQu1oFEePL+UEniRztQJAMfav -AtnpYKDSM+1jcp7uu9BemYGtzKDTTAYfoiNF42EzSJiGrWJDQn4eLgPjY0T0aAf/ -yGz3Z9ErbhMm/Ysl+QJBAL4kBxRT8gM4ByJw4sdOvSeCCANFq8fhbgm8pGWlCPb5 -JGmX3/GHFM8x2tbWMGpyZP1DLtiNEFz7eCGktWK5rqE= ------END RSA PRIVATE KEY----- diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/request.pem b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/request.pem deleted file mode 100644 index 51bc7f62..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/request.pem +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBhDCB7gIBADBFMQswCQYDVQQGEwJubzETMBEGA1UECAwKU29tZS1TdGF0ZTEh -MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEC -hrR/3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0W -ZxXgf72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwID -AQABoAAwDQYJKoZIhvcNAQEFBQADgYEAjsUXEARgfxZNkMjuUcudgU2w4JXS0gGI -JQ0U1LmU0vMDSKwqndMlvCbKzEgPbJnGJDI8D4MeINCJHa5Ceyb8c+jaJYUcCabl -lQW5Psn3+eWp8ncKlIycDRj1Qk615XuXtV0fhkrgQM2ZCm9LaQ1O1Gd/CzLihLjF -W0MmgMKMMRk= ------END CERTIFICATE REQUEST----- diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/textfile b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/textfile deleted file mode 100644 index a10483b0..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/fixtures/textfile +++ /dev/null @@ -1,9 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas, massa at aliquam luctus, sapien erat viverra elit, nec pulvinar turpis eros sagittis urna. Pellentesque imperdiet tempor varius. Pellentesque blandit, ipsum in imperdiet venenatis, mi elit faucibus odio, id condimentum ante enim sed lectus. Aliquam et odio non odio pellentesque pulvinar. Vestibulum a erat dolor. Integer pretium risus sit amet nisl volutpat nec venenatis magna egestas. Ut bibendum felis eu tellus laoreet eleifend. Nam pulvinar auctor tortor, eu iaculis leo vestibulum quis. In euismod risus ac purus vehicula et fermentum ligula consectetur. Vivamus condimentum tempus lacinia. - -Curabitur sodales condimentum urna id dictum. Sed quis justo sit amet quam ultrices tincidunt vel laoreet nulla. Nullam quis ipsum sed nisi mollis bibendum at sit amet nisi. Donec laoreet consequat velit sit amet mollis. Nam sed sapien a massa iaculis dapibus. Sed dui nunc, ultricies et pellentesque ullamcorper, aliquet vitae ligula. Integer eu velit in neque iaculis venenatis. Ut rhoncus cursus est, ac dignissim leo vehicula a. Nulla ullamcorper vulputate mauris id blandit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eleifend, nisi a tempor sollicitudin, odio massa pretium urna, quis congue sapien elit at tortor. Curabitur ipsum orci, vehicula non commodo molestie, laoreet id enim. Pellentesque convallis ultrices congue. Pellentesque nec iaculis lorem. In sagittis pharetra ipsum eget sodales. - -Fusce id nulla odio. Nunc nibh justo, placerat vel tincidunt sed, ornare et enim. Nulla vel urna vel ante commodo bibendum in vitae metus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis erat nunc, semper eget sagittis sit amet, ullamcorper eget lacus. Donec hendrerit ipsum vitae eros vestibulum eu gravida neque tincidunt. Ut molestie lacinia nulla. Donec mattis odio at magna egestas at pellentesque eros accumsan. Praesent interdum sem sit amet nibh commodo dignissim. Duis laoreet, enim ultricies fringilla suscipit, enim libero cursus nulla, sollicitudin adipiscing erat velit ut dui. Nulla eleifend mauris at velit fringilla a molestie lorem venenatis. - -Donec sit amet scelerisque metus. Cras ac felis a nulla venenatis vulputate. Duis porttitor eros ac neque rhoncus eget aliquet neque egestas. Quisque sed nunc est, vitae dapibus quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In vehicula, est vitae posuere ultricies, diam purus pretium sapien, nec rhoncus dolor nisl eget arcu. Aliquam et nisi vitae risus tincidunt auctor. In vehicula, erat a cursus adipiscing, lorem orci congue est, nec ultricies elit dui in nunc. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. - -Duis congue tempus elit sit amet auctor. Duis dignissim, risus ut sollicitudin ultricies, dolor ligula gravida odio, nec congue orci purus ut ligula. Fusce pretium dictum lectus at volutpat. Sed non auctor mauris. Etiam placerat vestibulum massa id blandit. Quisque consequat lacus ut nulla euismod facilisis. Sed aliquet ipsum nec mi imperdiet viverra. Pellentesque ullamcorper, lectus nec varius gravida, odio justo cursus risus, eu sagittis metus arcu quis felis. Phasellus consectetur vehicula libero, at condimentum orci euismod vel. Nunc purus tortor, suscipit nec fringilla nec, vulputate et nibh. Nam porta vehicula neque. Praesent porttitor, sapien eu auctor euismod, arcu quam elementum urna, sed hendrerit magna augue sed quam. \ No newline at end of file diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/hybi-common.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/hybi-common.js deleted file mode 100644 index 006f9c69..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/hybi-common.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Returns a Buffer from a "ff 00 ff"-type hex string. - */ - -getBufferFromHexString = function(byteStr) { - var bytes = byteStr.split(' '); - var buf = new Buffer(bytes.length); - for (var i = 0; i < bytes.length; ++i) { - buf[i] = parseInt(bytes[i], 16); - } - return buf; -} - -/** - * Returns a hex string from a Buffer. - */ - -getHexStringFromBuffer = function(data) { - var s = ''; - for (var i = 0; i < data.length; ++i) { - s += padl(data[i].toString(16), 2, '0') + ' '; - } - return s.trim(); -} - -/** - * Splits a buffer in two parts. - */ - -splitBuffer = function(buffer) { - var b1 = new Buffer(Math.ceil(buffer.length / 2)); - buffer.copy(b1, 0, 0, b1.length); - var b2 = new Buffer(Math.floor(buffer.length / 2)); - buffer.copy(b2, 0, b1.length, b1.length + b2.length); - return [b1, b2]; -} - -/** - * Performs hybi07+ type masking on a hex string or buffer. - */ - -mask = function(buf, maskString) { - if (typeof buf == 'string') buf = new Buffer(buf); - var mask = getBufferFromHexString(maskString || '34 83 a8 68'); - for (var i = 0; i < buf.length; ++i) { - buf[i] ^= mask[i % 4]; - } - return buf; -} - -/** - * Returns a hex string representing the length of a message - */ - -getHybiLengthAsHexString = function(len, masked) { - if (len < 126) { - var buf = new Buffer(1); - buf[0] = (masked ? 0x80 : 0) | len; - } - else if (len < 65536) { - var buf = new Buffer(3); - buf[0] = (masked ? 0x80 : 0) | 126; - getBufferFromHexString(pack(4, len)).copy(buf, 1); - } - else { - var buf = new Buffer(9); - buf[0] = (masked ? 0x80 : 0) | 127; - getBufferFromHexString(pack(16, len)).copy(buf, 1); - } - return getHexStringFromBuffer(buf); -} - -/** - * Unpacks a Buffer into a number. - */ - -unpack = function(buffer) { - var n = 0; - for (var i = 0; i < buffer.length; ++i) { - n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; - } - return n; -} - -/** - * Returns a hex string, representing a specific byte count 'length', from a number. - */ - -pack = function(length, number) { - return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim(); -} - -/** - * Left pads the string 's' to a total length of 'n' with char 'c'. - */ - -padl = function(s, n, c) { - return new Array(1 + n - s.length).join(c) + s; -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/testserver.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/testserver.js deleted file mode 100644 index 3e7a9667..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/testserver.js +++ /dev/null @@ -1,180 +0,0 @@ -var http = require('http') - , util = require('util') - , crypto = require('crypto') - , events = require('events') - , Sender = require('../lib/Sender') - , Receiver = require('../lib/Receiver'); - -module.exports = { - handlers: { - valid: validServer, - invalidKey: invalidRequestHandler, - closeAfterConnect: closeAfterConnectHandler, - return401: return401 - }, - createServer: function(port, handler, cb) { - if (handler && !cb) { - cb = handler; - handler = null; - } - var webServer = http.createServer(function (req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('okay'); - }); - var srv = new Server(webServer); - webServer.on('upgrade', function(req, socket) { - webServer._socket = socket; - (handler || validServer)(srv, req, socket); - }); - webServer.listen(port, '127.0.0.1', function() { cb(srv); }); - } -}; - -/** - * Test strategies - */ - -function validServer(server, req, socket) { - if (typeof req.headers.upgrade === 'undefined' || - req.headers.upgrade.toLowerCase() !== 'websocket') { - throw new Error('invalid headers'); - return; - } - - if (!req.headers['sec-websocket-key']) { - socket.end(); - throw new Error('websocket key is missing'); - } - - // calc key - var key = req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - socket.write(headers.concat('', '').join('\r\n')); - socket.setTimeout(0); - socket.setNoDelay(true); - - var sender = new Sender(socket); - var receiver = new Receiver(); - receiver.ontext = function (message, flags) { - server.emit('message', message, flags); - sender.send(message); - }; - receiver.onbinary = function (message, flags) { - flags = flags || {}; - flags.binary = true; - server.emit('message', message, flags); - sender.send(message, {binary: true}); - }; - receiver.onping = function (message, flags) { - flags = flags || {}; - server.emit('ping', message, flags); - }; - receiver.onpong = function (message, flags) { - flags = flags || {}; - server.emit('pong', message, flags); - }; - receiver.onclose = function (code, message, flags) { - flags = flags || {}; - server.emit('close', code, message, flags); - }; - socket.on('data', function (data) { - receiver.add(data); - }); - socket.on('end', function() { - socket.end(); - }); -} - -function invalidRequestHandler(server, req, socket) { - if (typeof req.headers.upgrade === 'undefined' || - req.headers.upgrade.toLowerCase() !== 'websocket') { - throw new Error('invalid headers'); - return; - } - - if (!req.headers['sec-websocket-key']) { - socket.end(); - throw new Error('websocket key is missing'); - } - - // calc key - var key = req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "bogus"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - socket.write(headers.concat('', '').join('\r\n')); - socket.end(); -} - -function closeAfterConnectHandler(server, req, socket) { - if (typeof req.headers.upgrade === 'undefined' || - req.headers.upgrade.toLowerCase() !== 'websocket') { - throw new Error('invalid headers'); - return; - } - - if (!req.headers['sec-websocket-key']) { - socket.end(); - throw new Error('websocket key is missing'); - } - - // calc key - var key = req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - socket.write(headers.concat('', '').join('\r\n')); - socket.end(); -} - - -function return401(server, req, socket) { - var headers = [ - 'HTTP/1.1 401 Unauthorized' - , 'Content-type: text/html' - ]; - - socket.write(headers.concat('', '').join('\r\n')); - socket.end(); -} - -/** - * Server object, which will do the actual emitting - */ - -function Server(webServer) { - this.webServer = webServer; -} - -util.inherits(Server, events.EventEmitter); - -Server.prototype.close = function() { - this.webServer.close(); - if (this._socket) this._socket.end(); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/README.md b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/README.md deleted file mode 100644 index 22aab8bd..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# node-XMLHttpRequest # - -node-XMLHttpRequest is a wrapper for the built-in http client to emulate the -browser XMLHttpRequest object. - -This can be used with JS designed for browsers to improve reuse of code and -allow the use of existing libraries. - -Note: This library currently conforms to [XMLHttpRequest 1](http://www.w3.org/TR/XMLHttpRequest/). Version 2.0 will target [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest2/). - -## Usage ## - -Here's how to include the module in your project and use as the browser-based -XHR object. - - var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; - var xhr = new XMLHttpRequest(); - -Note: use the lowercase string "xmlhttprequest" in your require(). On -case-sensitive systems (eg Linux) using uppercase letters won't work. - -## Versions ## - -Prior to 1.4.0 version numbers were arbitrary. From 1.4.0 on they conform to -the standard major.minor.bugfix. 1.x shouldn't necessarily be considered -stable just because it's above 0.x. - -Since the XMLHttpRequest API is stable this library's API is stable as -well. Major version numbers indicate significant core code changes. -Minor versions indicate minor core code changes or better conformity to -the W3C spec. - -## Supports ## - -* Async and synchronous requests -* GET, POST, PUT, and DELETE requests -* All spec methods (open, send, abort, getRequestHeader, - getAllRequestHeaders, event methods) -* Requests to all domains - -## Known Issues / Missing Features ## - -For a list of open issues or to report your own visit the [github issues -page](https://github.com/driverdan/node-XMLHttpRequest/issues). - -* Local file access may have unexpected results for non-UTF8 files -* Synchronous requests don't set headers properly -* Synchronous requests freeze node while waiting for response (But that's what you want, right? Stick with async!). -* Some events are missing, such as abort -* getRequestHeader is case-sensitive -* Cookies aren't persisted between requests -* Missing XML support -* Missing basic auth diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/autotest.watchr b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/autotest.watchr deleted file mode 100644 index 5324db6c..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/autotest.watchr +++ /dev/null @@ -1,8 +0,0 @@ -def run_all_tests - puts `clear` - puts `node tests/test-constants.js` - puts `node tests/test-headers.js` - puts `node tests/test-request.js` -end -watch('.*.js') { run_all_tests } -run_all_tests diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/example/demo.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/example/demo.js deleted file mode 100644 index 4f333de9..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/example/demo.js +++ /dev/null @@ -1,16 +0,0 @@ -var sys = require('util'); -var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; - -var xhr = new XMLHttpRequest(); - -xhr.onreadystatechange = function() { - sys.puts("State: " + this.readyState); - - if (this.readyState == 4) { - sys.puts("Complete.\nBody length: " + this.responseText.length); - sys.puts("Body:\n" + this.responseText); - } -}; - -xhr.open("GET", "http://driverdan.com"); -xhr.send(); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/lib/XMLHttpRequest.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/lib/XMLHttpRequest.js deleted file mode 100644 index 214a2e3b..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/lib/XMLHttpRequest.js +++ /dev/null @@ -1,548 +0,0 @@ -/** - * Wrapper for built-in http.js to emulate the browser XMLHttpRequest object. - * - * This can be used with JS designed for browsers to improve reuse of code and - * allow the use of existing libraries. - * - * Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs. - * - * @author Dan DeFelippi - * @contributor David Ellis - * @license MIT - */ - -var Url = require("url") - , spawn = require("child_process").spawn - , fs = require('fs'); - -exports.XMLHttpRequest = function() { - /** - * Private variables - */ - var self = this; - var http = require('http'); - var https = require('https'); - - // Holds http.js objects - var client; - var request; - var response; - - // Request settings - var settings = {}; - - // Set some default headers - var defaultHeaders = { - "User-Agent": "node-XMLHttpRequest", - "Accept": "*/*", - }; - - var headers = defaultHeaders; - - // These headers are not user setable. - // The following are allowed but banned in the spec: - // * user-agent - var forbiddenRequestHeaders = [ - "accept-charset", - "accept-encoding", - "access-control-request-headers", - "access-control-request-method", - "connection", - "content-length", - "content-transfer-encoding", - "cookie", - "cookie2", - "date", - "expect", - "host", - "keep-alive", - "origin", - "referer", - "te", - "trailer", - "transfer-encoding", - "upgrade", - "via" - ]; - - // These request methods are not allowed - var forbiddenRequestMethods = [ - "TRACE", - "TRACK", - "CONNECT" - ]; - - // Send flag - var sendFlag = false; - // Error flag, used when errors occur or abort is called - var errorFlag = false; - - // Event listeners - var listeners = {}; - - /** - * Constants - */ - - this.UNSENT = 0; - this.OPENED = 1; - this.HEADERS_RECEIVED = 2; - this.LOADING = 3; - this.DONE = 4; - - /** - * Public vars - */ - - // Current state - this.readyState = this.UNSENT; - - // default ready state change handler in case one is not set or is set late - this.onreadystatechange = null; - - // Result & response - this.responseText = ""; - this.responseXML = ""; - this.status = null; - this.statusText = null; - - /** - * Private methods - */ - - /** - * Check if the specified header is allowed. - * - * @param string header Header to validate - * @return boolean False if not allowed, otherwise true - */ - var isAllowedHttpHeader = function(header) { - return (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1); - }; - - /** - * Check if the specified method is allowed. - * - * @param string method Request method to validate - * @return boolean False if not allowed, otherwise true - */ - var isAllowedHttpMethod = function(method) { - return (method && forbiddenRequestMethods.indexOf(method) === -1); - }; - - /** - * Public methods - */ - - /** - * Open the connection. Currently supports local server requests. - * - * @param string method Connection method (eg GET, POST) - * @param string url URL for the connection. - * @param boolean async Asynchronous connection. Default is true. - * @param string user Username for basic authentication (optional) - * @param string password Password for basic authentication (optional) - */ - this.open = function(method, url, async, user, password) { - this.abort(); - errorFlag = false; - - // Check for valid request method - if (!isAllowedHttpMethod(method)) { - throw "SecurityError: Request method not allowed"; - return; - } - - settings = { - "method": method, - "url": url.toString(), - "async": (typeof async !== "boolean" ? true : async), - "user": user || null, - "password": password || null - }; - - setState(this.OPENED); - }; - - /** - * Sets a header for the request. - * - * @param string header Header name - * @param string value Header value - */ - this.setRequestHeader = function(header, value) { - if (this.readyState != this.OPENED) { - throw "INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN"; - } - if (!isAllowedHttpHeader(header)) { - console.warn('Refused to set unsafe header "' + header + '"'); - return; - } - if (sendFlag) { - throw "INVALID_STATE_ERR: send flag is true"; - } - headers[header] = value; - }; - - /** - * Gets a header from the server response. - * - * @param string header Name of header to get. - * @return string Text of the header or null if it doesn't exist. - */ - this.getResponseHeader = function(header) { - if (typeof header === "string" - && this.readyState > this.OPENED - && response.headers[header.toLowerCase()] - && !errorFlag - ) { - return response.headers[header.toLowerCase()]; - } - - return null; - }; - - /** - * Gets all the response headers. - * - * @return string A string with all response headers separated by CR+LF - */ - this.getAllResponseHeaders = function() { - if (this.readyState < this.HEADERS_RECEIVED || errorFlag) { - return ""; - } - var result = ""; - - for (var i in response.headers) { - // Cookie headers are excluded - if (i !== "set-cookie" && i !== "set-cookie2") { - result += i + ": " + response.headers[i] + "\r\n"; - } - } - return result.substr(0, result.length - 2); - }; - - /** - * Gets a request header - * - * @param string name Name of header to get - * @return string Returns the request header or empty string if not set - */ - this.getRequestHeader = function(name) { - // @TODO Make this case insensitive - if (typeof name === "string" && headers[name]) { - return headers[name]; - } - - return ""; - } - - /** - * Sends the request to the server. - * - * @param string data Optional data to send as request body. - */ - this.send = function(data) { - if (this.readyState != this.OPENED) { - throw "INVALID_STATE_ERR: connection must be opened before send() is called"; - } - - if (sendFlag) { - throw "INVALID_STATE_ERR: send has already been called"; - } - - var ssl = false, local = false; - var url = Url.parse(settings.url); - - // Determine the server - switch (url.protocol) { - case 'https:': - ssl = true; - // SSL & non-SSL both need host, no break here. - case 'http:': - var host = url.hostname; - break; - - case 'file:': - local = true; - break; - - case undefined: - case '': - var host = "localhost"; - break; - - default: - throw "Protocol not supported."; - } - - // Load files off the local filesystem (file://) - if (local) { - if (settings.method !== "GET") { - throw "XMLHttpRequest: Only GET method is supported"; - } - - if (settings.async) { - fs.readFile(url.pathname, 'utf8', function(error, data) { - if (error) { - self.handleError(error); - } else { - self.status = 200; - self.responseText = data; - setState(self.DONE); - } - }); - } else { - try { - this.responseText = fs.readFileSync(url.pathname, 'utf8'); - this.status = 200; - setState(self.DONE); - } catch(e) { - this.handleError(e); - } - } - - return; - } - - // Default to port 80. If accessing localhost on another port be sure - // to use http://localhost:port/path - var port = url.port || (ssl ? 443 : 80); - // Add query string if one is used - var uri = url.pathname + (url.search ? url.search : ''); - - // Set the Host header or the server may reject the request - headers["Host"] = host; - if (!((ssl && port === 443) || port === 80)) { - headers["Host"] += ':' + url.port; - } - - // Set Basic Auth if necessary - if (settings.user) { - if (typeof settings.password == "undefined") { - settings.password = ""; - } - var authBuf = new Buffer(settings.user + ":" + settings.password); - headers["Authorization"] = "Basic " + authBuf.toString("base64"); - } - - // Set content length header - if (settings.method === "GET" || settings.method === "HEAD") { - data = null; - } else if (data) { - headers["Content-Length"] = Buffer.byteLength(data); - - if (!headers["Content-Type"]) { - headers["Content-Type"] = "text/plain;charset=UTF-8"; - } - } else if (settings.method === "POST") { - // For a post with no data set Content-Length: 0. - // This is required by buggy servers that don't meet the specs. - headers["Content-Length"] = 0; - } - - var options = { - host: host, - port: port, - path: uri, - method: settings.method, - headers: headers - }; - - // Reset error flag - errorFlag = false; - - // Handle async requests - if (settings.async) { - // Use the proper protocol - var doRequest = ssl ? https.request : http.request; - - // Request is being sent, set send flag - sendFlag = true; - - // As per spec, this is called here for historical reasons. - self.dispatchEvent("readystatechange"); - - // Create the request - request = doRequest(options, function(resp) { - response = resp; - response.setEncoding("utf8"); - - setState(self.HEADERS_RECEIVED); - self.status = response.statusCode; - - response.on('data', function(chunk) { - // Make sure there's some data - if (chunk) { - self.responseText += chunk; - } - // Don't emit state changes if the connection has been aborted. - if (sendFlag) { - setState(self.LOADING); - } - }); - - response.on('end', function() { - if (sendFlag) { - // Discard the 'end' event if the connection has been aborted - setState(self.DONE); - sendFlag = false; - } - }); - - response.on('error', function(error) { - self.handleError(error); - }); - }).on('error', function(error) { - self.handleError(error); - }); - - // Node 0.4 and later won't accept empty data. Make sure it's needed. - if (data) { - request.write(data); - } - - request.end(); - - self.dispatchEvent("loadstart"); - } else { // Synchronous - // Create a temporary file for communication with the other Node process - var syncFile = ".node-xmlhttprequest-sync-" + process.pid; - fs.writeFileSync(syncFile, "", "utf8"); - // The async request the other Node process executes - var execString = "var http = require('http'), https = require('https'), fs = require('fs');" - + "var doRequest = http" + (ssl ? "s" : "") + ".request;" - + "var options = " + JSON.stringify(options) + ";" - + "var responseText = '';" - + "var req = doRequest(options, function(response) {" - + "response.setEncoding('utf8');" - + "response.on('data', function(chunk) {" - + "responseText += chunk;" - + "});" - + "response.on('end', function() {" - + "fs.writeFileSync('" + syncFile + "', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');" - + "});" - + "response.on('error', function(error) {" - + "fs.writeFileSync('" + syncFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');" - + "});" - + "}).on('error', function(error) {" - + "fs.writeFileSync('" + syncFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');" - + "});" - + (data ? "req.write('" + data.replace(/'/g, "\\'") + "');":"") - + "req.end();"; - // Start the other Node Process, executing this string - syncProc = spawn(process.argv[0], ["-e", execString]); - while((self.responseText = fs.readFileSync(syncFile, 'utf8')) == "") { - // Wait while the file is empty - } - // Kill the child process once the file has data - syncProc.stdin.end(); - // Remove the temporary file - fs.unlinkSync(syncFile); - if (self.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)) { - // If the file returned an error, handle it - var errorObj = self.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/, ""); - self.handleError(errorObj); - } else { - // If the file returned okay, parse its data and move to the DONE state - self.status = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/, "$1"); - self.responseText = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/, "$1"); - setState(self.DONE); - } - } - }; - - /** - * Called when an error is encountered to deal with it. - */ - this.handleError = function(error) { - this.status = 503; - this.statusText = error; - this.responseText = error.stack; - errorFlag = true; - setState(this.DONE); - }; - - /** - * Aborts a request. - */ - this.abort = function() { - if (request) { - request.abort(); - request = null; - } - - headers = defaultHeaders; - this.responseText = ""; - this.responseXML = ""; - - errorFlag = true; - - if (this.readyState !== this.UNSENT - && (this.readyState !== this.OPENED || sendFlag) - && this.readyState !== this.DONE) { - sendFlag = false; - setState(this.DONE); - } - this.readyState = this.UNSENT; - }; - - /** - * Adds an event listener. Preferred method of binding to events. - */ - this.addEventListener = function(event, callback) { - if (!(event in listeners)) { - listeners[event] = []; - } - // Currently allows duplicate callbacks. Should it? - listeners[event].push(callback); - }; - - /** - * Remove an event callback that has already been bound. - * Only works on the matching funciton, cannot be a copy. - */ - this.removeEventListener = function(event, callback) { - if (event in listeners) { - // Filter will return a new array with the callback removed - listeners[event] = listeners[event].filter(function(ev) { - return ev !== callback; - }); - } - }; - - /** - * Dispatch any events, including both "on" methods and events attached using addEventListener. - */ - this.dispatchEvent = function(event) { - if (typeof self["on" + event] === "function") { - self["on" + event](); - } - if (event in listeners) { - for (var i = 0, len = listeners[event].length; i < len; i++) { - listeners[event][i].call(self); - } - } - }; - - /** - * Changes readyState and calls onreadystatechange. - * - * @param int state New state - */ - var setState = function(state) { - if (self.readyState !== state) { - self.readyState = state; - - if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) { - self.dispatchEvent("readystatechange"); - } - - if (self.readyState === self.DONE && !errorFlag) { - self.dispatchEvent("load"); - // @TODO figure out InspectorInstrumentation::didLoadXHR(cookie) - self.dispatchEvent("loadend"); - } - } - }; -}; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/package.json deleted file mode 100644 index 68923a67..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "xmlhttprequest", - "description": "XMLHttpRequest for Node", - "version": "1.4.2", - "author": { - "name": "Dan DeFelippi", - "url": "http://driverdan.com" - }, - "keywords": [ - "xhr", - "ajax" - ], - "licenses": [ - { - "type": "MIT", - "url": "http://creativecommons.org/licenses/MIT/" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/driverdan/node-XMLHttpRequest.git" - }, - "bugs": { - "name": "http://github.com/driverdan/node-XMLHttpRequest/issues" - }, - "engines": { - "node": ">=0.4.0" - }, - "directories": { - "lib": "./lib", - "example": "./example" - }, - "main": "./lib/XMLHttpRequest.js", - "_id": "xmlhttprequest@1.4.2", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "241b6a3661c344aa684950a250a1dabda230e568" - }, - "_from": "xmlhttprequest@1.4.2" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-constants.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-constants.js deleted file mode 100644 index 372e46cc..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-constants.js +++ /dev/null @@ -1,13 +0,0 @@ -var sys = require("util") - , assert = require("assert") - , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest - , xhr = new XMLHttpRequest(); - -// Test constant values -assert.equal(0, xhr.UNSENT); -assert.equal(1, xhr.OPENED); -assert.equal(2, xhr.HEADERS_RECEIVED); -assert.equal(3, xhr.LOADING); -assert.equal(4, xhr.DONE); - -sys.puts("done"); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-events.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-events.js deleted file mode 100644 index c72f001d..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-events.js +++ /dev/null @@ -1,50 +0,0 @@ -var sys = require("util") - , assert = require("assert") - , http = require("http") - , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest - , xhr; - -// Test server -var server = http.createServer(function (req, res) { - var body = (req.method != "HEAD" ? "Hello World" : ""); - - res.writeHead(200, { - "Content-Type": "text/plain", - "Content-Length": Buffer.byteLength(body) - }); - // HEAD has no body - if (req.method != "HEAD") { - res.write(body); - } - res.end(); - assert.equal(onreadystatechange, true); - assert.equal(readystatechange, true); - assert.equal(removed, true); - sys.puts("done"); - this.close(); -}).listen(8000); - -xhr = new XMLHttpRequest(); - -// Track event calls -var onreadystatechange = false; -var readystatechange = false; -var removed = true; -var removedEvent = function() { - removed = false; -}; - -xhr.onreadystatechange = function() { - onreadystatechange = true; -}; - -xhr.addEventListener("readystatechange", function() { - readystatechange = true; -}); - -// This isn't perfect, won't guarantee it was added in the first place -xhr.addEventListener("readystatechange", removedEvent); -xhr.removeEventListener("readystatechange", removedEvent); - -xhr.open("GET", "http://localhost:8000"); -xhr.send(); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-exceptions.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-exceptions.js deleted file mode 100644 index f1edd71f..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-exceptions.js +++ /dev/null @@ -1,62 +0,0 @@ -var sys = require("util") - , assert = require("assert") - , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest - , xhr = new XMLHttpRequest(); - -// Test request methods that aren't allowed -try { - xhr.open("TRACK", "http://localhost:8000/"); - console.log("ERROR: TRACK should have thrown exception"); -} catch(e) {} -try { - xhr.open("TRACE", "http://localhost:8000/"); - console.log("ERROR: TRACE should have thrown exception"); -} catch(e) {} -try { - xhr.open("CONNECT", "http://localhost:8000/"); - console.log("ERROR: CONNECT should have thrown exception"); -} catch(e) {} -// Test valid request method -try { - xhr.open("GET", "http://localhost:8000/"); -} catch(e) { - console.log("ERROR: Invalid exception for GET", e); -} - -// Test forbidden headers -var forbiddenRequestHeaders = [ - "accept-charset", - "accept-encoding", - "access-control-request-headers", - "access-control-request-method", - "connection", - "content-length", - "content-transfer-encoding", - "cookie", - "cookie2", - "date", - "expect", - "host", - "keep-alive", - "origin", - "referer", - "te", - "trailer", - "transfer-encoding", - "upgrade", - "user-agent", - "via" -]; - -for (var i in forbiddenRequestHeaders) { - try { - xhr.setRequestHeader(forbiddenRequestHeaders[i], "Test"); - console.log("ERROR: " + forbiddenRequestHeaders[i] + " should have thrown exception"); - } catch(e) { - } -} - -// Try valid header -xhr.setRequestHeader("X-Foobar", "Test"); - -console.log("Done"); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-headers.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-headers.js deleted file mode 100644 index 2ecb045d..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-headers.js +++ /dev/null @@ -1,61 +0,0 @@ -var sys = require("util") - , assert = require("assert") - , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest - , xhr = new XMLHttpRequest() - , http = require("http"); - -// Test server -var server = http.createServer(function (req, res) { - // Test setRequestHeader - assert.equal("Foobar", req.headers["x-test"]); - - var body = "Hello World"; - res.writeHead(200, { - "Content-Type": "text/plain", - "Content-Length": Buffer.byteLength(body), - // Set cookie headers to see if they're correctly suppressed - // Actual values don't matter - "Set-Cookie": "foo=bar", - "Set-Cookie2": "bar=baz", - "Connection": "close" - }); - res.write("Hello World"); - res.end(); - - this.close(); -}).listen(8000); - -xhr.onreadystatechange = function() { - if (this.readyState == 4) { - // Test getAllResponseHeaders() - var headers = "content-type: text/plain\r\ncontent-length: 11\r\nconnection: close"; - assert.equal(headers, this.getAllResponseHeaders()); - - // Test case insensitivity - assert.equal('text/plain', this.getResponseHeader('Content-Type')); - assert.equal('text/plain', this.getResponseHeader('Content-type')); - assert.equal('text/plain', this.getResponseHeader('content-Type')); - assert.equal('text/plain', this.getResponseHeader('content-type')); - - // Test aborted getAllResponseHeaders - this.abort(); - assert.equal("", this.getAllResponseHeaders()); - assert.equal(null, this.getResponseHeader("Connection")); - - sys.puts("done"); - } -}; - -assert.equal(null, xhr.getResponseHeader("Content-Type")); -try { - xhr.open("GET", "http://localhost:8000/"); - // Valid header - xhr.setRequestHeader("X-Test", "Foobar"); - // Invalid header - xhr.setRequestHeader("Content-Length", 0); - // Test getRequestHeader - assert.equal("Foobar", xhr.getRequestHeader("X-Test")); - xhr.send(); -} catch(e) { - console.log("ERROR: Exception raised", e); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-request-methods.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-request-methods.js deleted file mode 100644 index fa1b1bed..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-request-methods.js +++ /dev/null @@ -1,62 +0,0 @@ -var sys = require("util") - , assert = require("assert") - , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest - , http = require("http") - , xhr; - -// Test server -var server = http.createServer(function (req, res) { - // Check request method and URL - assert.equal(methods[curMethod], req.method); - assert.equal("/" + methods[curMethod], req.url); - - var body = (req.method != "HEAD" ? "Hello World" : ""); - - res.writeHead(200, { - "Content-Type": "text/plain", - "Content-Length": Buffer.byteLength(body) - }); - // HEAD has no body - if (req.method != "HEAD") { - res.write(body); - } - res.end(); - - if (curMethod == methods.length - 1) { - this.close(); - sys.puts("done"); - } -}).listen(8000); - -// Test standard methods -var methods = ["GET", "POST", "HEAD", "PUT", "DELETE"]; -var curMethod = 0; - -function start(method) { - // Reset each time - xhr = new XMLHttpRequest(); - - xhr.onreadystatechange = function() { - if (this.readyState == 4) { - if (method == "HEAD") { - assert.equal("", this.responseText); - } else { - assert.equal("Hello World", this.responseText); - } - - curMethod++; - - if (curMethod < methods.length) { - sys.puts("Testing " + methods[curMethod]); - start(methods[curMethod]); - } - } - }; - - var url = "http://localhost:8000/" + method; - xhr.open(method, url); - xhr.send(); -} - -sys.puts("Testing " + methods[curMethod]); -start(methods[curMethod]); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-request-protocols.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-request-protocols.js deleted file mode 100644 index cd4e1745..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/test-request-protocols.js +++ /dev/null @@ -1,34 +0,0 @@ -var sys = require("util") - , assert = require("assert") - , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest - , xhr; - -xhr = new XMLHttpRequest(); - -xhr.onreadystatechange = function() { - if (this.readyState == 4) { - assert.equal("Hello World", this.responseText); - this.close(); - runSync(); - } -}; - -// Async -var url = "file://" + __dirname + "/testdata.txt"; -xhr.open("GET", url); -xhr.send(); - -// Sync -var runSync = function() { - xhr = new XMLHttpRequest(); - - xhr.onreadystatechange = function() { - if (this.readyState == 4) { - assert.equal("Hello World", this.responseText); - this.close(); - sys.puts("done"); - } - }; - xhr.open("GET", url, false); - xhr.send(); -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/testdata.txt b/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/testdata.txt deleted file mode 100644 index 557db03d..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/tests/testdata.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/package.json b/realtime/node_modules/socket.io/node_modules/socket.io-client/package.json deleted file mode 100644 index b4be1cc8..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "socket.io-client", - "description": "Socket.IO client for the browser and node.js", - "version": "0.9.11", - "main": "./lib/io.js", - "browserify": "./dist/socket.io.js", - "homepage": "http://socket.io", - "keywords": [ - "websocket", - "socket", - "realtime", - "socket.io", - "comet", - "ajax" - ], - "author": { - "name": "Guillermo Rauch", - "email": "guillermo@learnboost.com" - }, - "contributors": [ - { - "name": "Guillermo Rauch", - "email": "rauchg@gmail.com" - }, - { - "name": "Arnout Kazemier", - "email": "info@3rd-eden.com" - }, - { - "name": "Vladimir Dronnikov", - "email": "dronnikov@gmail.com" - }, - { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/LearnBoost/socket.io-client.git" - }, - "dependencies": { - "uglify-js": "1.2.5", - "ws": "0.4.x", - "xmlhttprequest": "1.4.2", - "active-x-obfuscator": "0.0.1" - }, - "devDependencies": { - "expresso": "*", - "express": "2.5.x", - "jade": "*", - "stylus": "*", - "socket.io": "0.9.11", - "socket.io-client": "0.9.11", - "should": "*" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "socket.io-client@0.9.11", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "c6e358c61862c034a583ed5c747de13920edf34e" - }, - "_from": "socket.io-client@0.9.11" -} diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/events.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/events.test.js deleted file mode 100644 index 365c4223..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/events.test.js +++ /dev/null @@ -1,120 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (module, io, should) { - - module.exports = { - - 'add listeners': function () { - var event = new io.EventEmitter - , calls = 0; - - event.on('test', function (a, b) { - ++calls; - a.should().eql('a'); - b.should().eql('b'); - }); - - event.emit('test', 'a', 'b'); - calls.should().eql(1); - event.on.should().eql(event.addListener); - }, - - 'remove listener': function () { - var event = new io.EventEmitter; - function empty () { } - - event.on('test', empty); - event.on('test:more', empty); - event.removeAllListeners('test'); - - event.listeners('test').should().eql([]); - event.listeners('test:more').should().eql([empty]); - }, - - 'remove all listeners with no arguments': function () { - var event = new io.EventEmitter; - function empty () { } - - event.on('test', empty); - event.on('test:more', empty); - event.removeAllListeners(); - - event.listeners('test').should().eql([]); - event.listeners('test:more').should().eql([]); - }, - - 'remove listeners functions': function () { - var event = new io.EventEmitter - , calls = 0; - - function one () { ++calls } - function two () { ++calls } - function three () { ++calls } - - event.on('one', one); - event.removeListener('one', one); - event.listeners('one').should().eql([]); - - event.on('two', two); - event.removeListener('two', one); - event.listeners('two').should().eql([two]); - - event.on('three', three); - event.on('three', two); - event.removeListener('three', three); - event.listeners('three').should().eql([two]); - }, - - 'number of arguments': function () { - var event = new io.EventEmitter - , number = []; - - event.on('test', function () { - number.push(arguments.length); - }); - - event.emit('test'); - event.emit('test', null); - event.emit('test', null, null); - event.emit('test', null, null, null); - event.emit('test', null, null, null, null); - event.emit('test', null, null, null, null, null); - - [0, 1, 2, 3, 4, 5].should().eql(number); - }, - - 'once': function () { - var event = new io.EventEmitter - , calls = 0; - - event.once('test', function (a, b) { - ++calls; - }); - - event.emit('test', 'a', 'b'); - event.emit('test', 'a', 'b'); - event.emit('test', 'a', 'b'); - - function removed () { - should().fail('not removed'); - }; - - event.once('test:removed', removed); - event.removeListener('test:removed', removed); - event.emit('test:removed'); - - calls.should().eql(1); - } - - }; - -})( - 'undefined' == typeof module ? module = {} : module - , 'undefined' == typeof io ? require('socket.io-client') : io - , 'undefined' == typeof should || !should.fail ? require('should') : should -); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/io.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/io.test.js deleted file mode 100644 index d9f0b09e..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/io.test.js +++ /dev/null @@ -1,31 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (module, io, should) { - - module.exports = { - - 'client version number': function () { - io.version.should().match(/([0-9]+)\.([0-9]+)\.([0-9]+)/); - }, - - 'socket.io protocol version': function () { - io.protocol.should().be.a('number'); - io.protocol.toString().should().match(/^\d+$/); - }, - - 'socket.io available transports': function () { - (io.transports.length > 0).should().be_true; - } - - }; - -})( - 'undefined' == typeof module ? module = {} : module - , 'undefined' == typeof io ? require('socket.io-client') : io - , 'undefined' == typeof should ? require('should') : should -); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/node/builder.common.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/node/builder.common.js deleted file mode 100644 index fa8d46ed..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/node/builder.common.js +++ /dev/null @@ -1,102 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -var vm = require('vm') - , should = require('should'); - -/** - * Generates evn variables for the vm so we can `emulate` a browser. - * @returns {Object} evn variables - */ - -exports.env = function env () { - var details = { - location: { - port: 8080 - , host: 'www.example.org' - , hostname: 'www.example.org' - , href: 'http://www.example.org/example/' - , pathname: '/example/' - , protocol: 'http:' - , search: '' - , hash: '' - } - , console: { - log: function(){}, - info: function(){}, - warn: function(){}, - error: function(){} - } - , navigator: { - userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit' - + '/534.27 (KHTML, like Gecko) Chrome/12.0.716.0 Safari/534.27' - , appName: 'socket.io' - , platform: process.platform - , appVersion: process.version - , } - , name: 'socket.io' - , innerWidth: 1024 - , innerHeight: 768 - , length: 1 - , outerWidth: 1024 - , outerHeight: 768 - , pageXOffset: 0 - , pageYOffset: 0 - , screenX: 0 - , screenY: 0 - , screenLeft: 0 - , screenTop: 0 - , scrollX: 0 - , scrollY: 0 - , scrollTop: 0 - , scrollLeft: 0 - , screen: { - width: 0 - , height: 0 - } - }; - - // circular references - details.window = details.self = details.contentWindow = details; - - // callable methods - details.Image = details.scrollTo = details.scrollBy = details.scroll = - details.resizeTo = details.resizeBy = details.prompt = details.print = - details.open = details.moveTo = details.moveBy = details.focus = - details.createPopup = details.confirm = details.close = details.blur = - details.alert = details.clearTimeout = details.clearInterval = - details.setInterval = details.setTimeout = details.XMLHttpRequest = - details.getComputedStyle = details.trigger = details.dispatchEvent = - details.removeEventListener = details.addEventListener = function(){}; - - // frames - details.frames = [details]; - - // document - details.document = details; - details.document.domain = details.location.href; - - return details; -}; - -/** - * Executes a script in a browser like env and returns - * the result - * - * @param {String} contents The script content - * @returns {Object} The evaluated script. - */ - -exports.execute = function execute (contents) { - var env = exports.env() - , script = vm.createScript(contents); - - // run the script with `browser like` globals - script.runInNewContext(env); - - return env; -}; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/node/builder.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/node/builder.test.js deleted file mode 100644 index 989e2bc5..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/node/builder.test.js +++ /dev/null @@ -1,131 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Test dependencies. - */ - -var builder = require('../../bin/builder') - , common = require('./builder.common') - , should = require('should'); - -/** - * Tests. - */ - -module.exports = { - - 'version number': function () { - builder.version.should().match(/([0-9]+)\.([0-9]+)\.([0-9]+)/); - builder.version.should().equal(require('../../lib/io').version); - }, - - 'production build LOC': function () { - builder(function (err, result) { - should.strictEqual(err, null) - - var lines = result.split('\n'); - lines.length.should().be.below(5); - lines[0].should().match(/production/gi); - Buffer.byteLength(result).should().be.below(43000); - }); - }, - - 'development build LOC': function () { - builder({ minify: false }, function (err, result) { - should.strictEqual(err, null) - - var lines = result.split('\n'); - lines.length.should().be.above(5); - lines[0].should().match(/development/gi); - Buffer.byteLength(result).should().be.above(35000); - }); - }, - - 'default builds': function () { - builder(function (err, result) { - should.strictEqual(err, null); - - var io = common.execute(result).io - , transports = Object.keys(io.Transport) - , defaults = Object.keys(builder.transports); - - /* XHR transport is private, but still available */ - transports.length.should().be.equal(defaults.length + 1); - - defaults.forEach(function (transport) { - transports.indexOf(transport).should().be.above(-1); - }) - }); - }, - - 'custom build': function () { - builder(['websocket'], function (err, result) { - should.strictEqual(err, null); - - var io = common.execute(result).io - , transports = Object.keys(io.Transport); - - transports.should().have.length(1); - transports[0].should().eql('websocket'); - }); - }, - - 'custom code': function () { - var custom = 'var hello = "world";'; - builder({ custom: [custom], minify: false }, function (err, result) { - should.strictEqual(err, null); - - result.should().include.string(custom); - }); - }, - - 'node if': function () { - var custom = '// if node \nvar hello = "world";\n' - + '// end node\nvar pew = "pew";'; - - builder({ custom: [custom], minify: false }, function (err, result) { - should.strictEqual(err, null); - - result.should().not.include.string(custom); - result.should().not.include.string('// if node'); - result.should().not.include.string('// end node'); - result.should().not.include.string('"world"'); - - result.should().include.string('var pew = "pew"'); - }); - }, - - 'preserve the encoding during minification': function () { - builder(function (err, result) { - should.strictEqual(err, null); - - result.should().match(/(\\ufffd)/g); - }) - }, - - 'globals': function () { - builder(function (err, result) { - should.strictEqual(err, null); - - var io = common.execute(result) - , env = common.env() - , allowed = ['io', 'swfobject', 'WEB_SOCKET_DISABLE_AUTO_INITIALIZATION']; - - Array.prototype.push.apply(allowed, Object.keys(env)); - - Object.keys(io).forEach(function (global) { - var index = allowed.indexOf(global); - - // the global is not allowed! - if (!~index) { - throw new Error('Global leak: ' + global); - } - }); - }) - } - -}; diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/parser.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/parser.test.js deleted file mode 100644 index 0022afb2..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/parser.test.js +++ /dev/null @@ -1,360 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (module, io, should) { - - var parser = io.parser; - - module.exports = { - - 'decoding error packet': function () { - parser.decodePacket('7:::').should().eql({ - type: 'error' - , reason: '' - , advice: '' - , endpoint: '' - }); - }, - - 'decoding error packet with reason': function () { - parser.decodePacket('7:::0').should().eql({ - type: 'error' - , reason: 'transport not supported' - , advice: '' - , endpoint: '' - }); - }, - - 'decoding error packet with reason and advice': function () { - parser.decodePacket('7:::2+0').should().eql({ - type: 'error' - , reason: 'unauthorized' - , advice: 'reconnect' - , endpoint: '' - }); - }, - - 'decoding error packet with endpoint': function () { - parser.decodePacket('7::/woot').should().eql({ - type: 'error' - , reason: '' - , advice: '' - , endpoint: '/woot' - }); - }, - - 'decoding ack packet': function () { - parser.decodePacket('6:::140').should().eql({ - type: 'ack' - , ackId: '140' - , endpoint: '' - , args: [] - }); - }, - - 'decoding ack packet with args': function () { - parser.decodePacket('6:::12+["woot","wa"]').should().eql({ - type: 'ack' - , ackId: '12' - , endpoint: '' - , args: ['woot', 'wa'] - }); - }, - - 'decoding ack packet with bad json': function () { - var thrown = false; - - try { - parser.decodePacket('6:::1+{"++]').should().eql({ - type: 'ack' - , ackId: '1' - , endpoint: '' - , args: [] - }); - } catch (e) { - thrown = true; - } - - thrown.should().be_false; - }, - - 'decoding json packet': function () { - parser.decodePacket('4:::"2"').should().eql({ - type: 'json' - , endpoint: '' - , data: '2' - }); - }, - - 'decoding json packet with message id and ack data': function () { - parser.decodePacket('4:1+::{"a":"b"}').should().eql({ - type: 'json' - , id: 1 - , ack: 'data' - , endpoint: '' - , data: { a: 'b' } - }); - }, - - 'decoding an event packet': function () { - parser.decodePacket('5:::{"name":"woot"}').should().eql({ - type: 'event' - , name: 'woot' - , endpoint: '' - , args: [] - }); - }, - - 'decoding an event packet with message id and ack': function () { - parser.decodePacket('5:1+::{"name":"tobi"}').should().eql({ - type: 'event' - , id: 1 - , ack: 'data' - , endpoint: '' - , name: 'tobi' - , args: [] - }); - }, - - 'decoding an event packet with data': function () { - parser.decodePacket('5:::{"name":"edwald","args":[{"a": "b"},2,"3"]}') - .should().eql({ - type: 'event' - , name: 'edwald' - , endpoint: '' - , args: [{a: 'b'}, 2, '3'] - }); - }, - - 'decoding a message packet': function () { - parser.decodePacket('3:::woot').should().eql({ - type: 'message' - , endpoint: '' - , data: 'woot' - }); - }, - - 'decoding a message packet with id and endpoint': function () { - parser.decodePacket('3:5:/tobi').should().eql({ - type: 'message' - , id: 5 - , ack: true - , endpoint: '/tobi' - , data: '' - }); - }, - - 'decoding a heartbeat packet': function () { - parser.decodePacket('2:::').should().eql({ - type: 'heartbeat' - , endpoint: '' - }); - }, - - 'decoding a connection packet': function () { - parser.decodePacket('1::/tobi').should().eql({ - type: 'connect' - , endpoint: '/tobi' - , qs: '' - }); - }, - - 'decoding a connection packet with query string': function () { - parser.decodePacket('1::/test:?test=1').should().eql({ - type: 'connect' - , endpoint: '/test' - , qs: '?test=1' - }); - }, - - 'decoding a disconnection packet': function () { - parser.decodePacket('0::/woot').should().eql({ - type: 'disconnect' - , endpoint: '/woot' - }); - }, - - 'encoding error packet': function () { - parser.encodePacket({ - type: 'error' - , reason: '' - , advice: '' - , endpoint: '' - }).should().eql('7::'); - }, - - 'encoding error packet with reason': function () { - parser.encodePacket({ - type: 'error' - , reason: 'transport not supported' - , advice: '' - , endpoint: '' - }).should().eql('7:::0'); - }, - - 'encoding error packet with reason and advice': function () { - parser.encodePacket({ - type: 'error' - , reason: 'unauthorized' - , advice: 'reconnect' - , endpoint: '' - }).should().eql('7:::2+0'); - }, - - 'encoding error packet with endpoint': function () { - parser.encodePacket({ - type: 'error' - , reason: '' - , advice: '' - , endpoint: '/woot' - }).should().eql('7::/woot'); - }, - - 'encoding ack packet': function () { - parser.encodePacket({ - type: 'ack' - , ackId: '140' - , endpoint: '' - , args: [] - }).should().eql('6:::140'); - }, - - 'encoding ack packet with args': function () { - parser.encodePacket({ - type: 'ack' - , ackId: '12' - , endpoint: '' - , args: ['woot', 'wa'] - }).should().eql('6:::12+["woot","wa"]'); - }, - - 'encoding json packet': function () { - parser.encodePacket({ - type: 'json' - , endpoint: '' - , data: '2' - }).should().eql('4:::"2"'); - }, - - 'encoding json packet with message id and ack data': function () { - parser.encodePacket({ - type: 'json' - , id: 1 - , ack: 'data' - , endpoint: '' - , data: { a: 'b' } - }).should().eql('4:1+::{"a":"b"}'); - }, - - 'encoding an event packet': function () { - parser.encodePacket({ - type: 'event' - , name: 'woot' - , endpoint: '' - , args: [] - }).should().eql('5:::{"name":"woot"}'); - }, - - 'encoding an event packet with message id and ack': function () { - parser.encodePacket({ - type: 'event' - , id: 1 - , ack: 'data' - , endpoint: '' - , name: 'tobi' - , args: [] - }).should().eql('5:1+::{"name":"tobi"}'); - }, - - 'encoding an event packet with data': function () { - parser.encodePacket({ - type: 'event' - , name: 'edwald' - , endpoint: '' - , args: [{a: 'b'}, 2, '3'] - }).should().eql('5:::{"name":"edwald","args":[{"a":"b"},2,"3"]}'); - }, - - 'encoding a message packet': function () { - parser.encodePacket({ - type: 'message' - , endpoint: '' - , data: 'woot' - }).should().eql('3:::woot'); - }, - - 'encoding a message packet with id and endpoint': function () { - parser.encodePacket({ - type: 'message' - , id: 5 - , ack: true - , endpoint: '/tobi' - , data: '' - }).should().eql('3:5:/tobi'); - }, - - 'encoding a heartbeat packet': function () { - parser.encodePacket({ - type: 'heartbeat' - , endpoint: '' - }).should().eql('2::'); - }, - - 'encoding a connection packet': function () { - parser.encodePacket({ - type: 'connect' - , endpoint: '/tobi' - , qs: '' - }).should().eql('1::/tobi'); - }, - - 'encoding a connection packet with query string': function () { - parser.encodePacket({ - type: 'connect' - , endpoint: '/test' - , qs: '?test=1' - }).should().eql('1::/test:?test=1'); - }, - - 'encoding a disconnection packet': function () { - parser.encodePacket({ - type: 'disconnect' - , endpoint: '/woot' - }).should().eql('0::/woot'); - }, - - 'test decoding a payload': function () { - parser.decodePayload('\ufffd5\ufffd3:::5\ufffd7\ufffd3:::53d' - + '\ufffd3\ufffd0::').should().eql([ - { type: 'message', data: '5', endpoint: '' } - , { type: 'message', data: '53d', endpoint: '' } - , { type: 'disconnect', endpoint: '' } - ]); - }, - - 'test encoding a payload': function () { - parser.encodePayload([ - parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) - ]).should().eql('\ufffd5\ufffd3:::5\ufffd7\ufffd3:::53d') - }, - - 'test decoding newline': function () { - parser.decodePacket('3:::\n').should().eql({ - type: 'message' - , endpoint: '' - , data: '\n' - }); - } - - }; - -})( - 'undefined' == typeof module ? module = {} : module - , 'undefined' == typeof io ? require('socket.io-client') : io - , 'undefined' == typeof should ? require('should') : should -); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/socket.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/socket.test.js deleted file mode 100644 index eae49564..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/socket.test.js +++ /dev/null @@ -1,422 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (module, io, should) { - - if ('object' == typeof global) { - return module.exports = { '': function () {} }; - } - - module.exports = { - - 'test connecting the socket and disconnecting': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.disconnect(); - next(); - }); - }, - - 'test receiving messages': function (next) { - var socket = create() - , connected = false - , messages = 0; - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - connected = true; - }); - - socket.on('message', function (i) { - String(++messages).should().equal(i); - }); - - socket.on('disconnect', function (reason) { - connected.should().be_true; - messages.should().equal(3); - reason.should().eql('booted'); - next(); - }); - }, - - 'test sending messages': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.send('echo'); - - socket.on('message', function (msg) { - msg.should().equal('echo'); - socket.disconnect(); - next(); - }); - }); - }, - - 'test manual buffer flushing': function (next) { - var socket = create(); - - socket.socket.options['manualFlush'] = true; - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.socket.connected = false; - socket.send('buffered'); - socket.socket.onConnect(); - socket.socket.flushBuffer(); - - socket.on('message', function (msg) { - msg.should().equal('buffered'); - socket.disconnect(); - next(); - }); - }); - }, - - 'test automatic buffer flushing': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.socket.connected = false; - socket.send('buffered'); - socket.socket.onConnect(); - - socket.on('message', function (msg) { - msg.should().equal('buffered'); - socket.disconnect(); - next(); - }); - }); - }, - - 'test acks sent from client': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.on('message', function (msg) { - if ('tobi 2' == msg) { - socket.disconnect(); - next(); - } - }); - }); - }, - - 'test acks sent from server': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.send('ooo', function () { - socket.disconnect(); - next(); - }); - }); - }, - - 'test connecting to namespaces': function (next) { - var io = create() - , socket = io.socket - , namespaces = 2 - , connect = 0; - - function finish () { - socket.of('').disconnect(); - connect.should().equal(3); - next(); - } - - socket.on('connect', function(){ - connect++; - }); - - socket.of('/woot').on('connect', function () { - connect++; - }).on('message', function (msg) { - msg.should().equal('connected to woot'); - --namespaces || finish(); - }).on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.of('/chat').on('connect', function () { - connect++; - }).on('message', function (msg) { - msg.should().equal('connected to chat'); - --namespaces || finish(); - }).on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - }, - - 'test disconnecting from namespaces': function (next) { - var socket = create().socket - , namespaces = 2 - , disconnections = 0; - - function finish () { - socket.of('').disconnect(); - next(); - }; - - socket.of('/a').on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.of('/a').on('connect', function () { - socket.of('/a').disconnect(); - }); - - socket.of('/a').on('disconnect', function () { - --namespaces || finish(); - }); - - socket.of('/b').on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.of('/b').on('connect', function () { - socket.of('/b').disconnect(); - }); - - socket.of('/b').on('disconnect', function () { - --namespaces || finish(); - }); - }, - - 'test authorizing for namespaces': function (next) { - var socket = create().socket - - function finish () { - socket.of('').disconnect(); - next(); - }; - - socket.of('/a') - .on('connect_failed', function (msg) { - next(); - }) - .on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - }, - - 'test sending json from server': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('message', function (msg) { - msg.should().eql(3141592); - socket.disconnect(); - next(); - }); - }, - - 'test sending json from client': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.json.send([1, 2, 3]); - socket.on('message', function (msg) { - msg.should().equal('echo'); - socket.disconnect(); - next(); - }); - }, - - 'test emitting an event from server': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('woot', function () { - socket.disconnect(); - next(); - }); - }, - - 'test emitting an event to server': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.emit('woot'); - socket.on('echo', function () { - socket.disconnect(); - next(); - }) - }, - - 'test emitting multiple events at once to the server': function (next) { - var socket = create(); - - socket.on('connect', function () { - socket.emit('print', 'foo'); - socket.emit('print', 'bar'); - }); - - socket.on('done', function () { - socket.disconnect(); - next(); - }); - }, - - 'test emitting an event from server and sending back data': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('woot', function (a, fn) { - a.should().eql(1); - fn('test'); - - socket.on('done', function () { - socket.disconnect(); - next(); - }); - }); - }, - - 'test emitting an event to server and sending back data': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.emit('tobi', 1, 2, function (a) { - a.should().eql({ hello: 'world' }); - socket.disconnect(); - next(); - }); - }, - - 'test encoding a payload': function (next) { - var socket = create('/woot'); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('connect', function () { - socket.socket.setBuffer(true); - socket.send('ñ'); - socket.send('ñ'); - socket.send('ñ'); - socket.send('ñ'); - socket.socket.setBuffer(false); - }); - - socket.on('done', function () { - socket.disconnect(); - next(); - }); - }, - - 'test sending query strings to the server': function (next) { - var socket = create('?foo=bar'); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.on('message', function (data) { - data.query.foo.should().eql('bar'); - - socket.disconnect(); - next(); - }); - }, - - 'test sending newline': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.send('\n'); - - socket.on('done', function () { - socket.disconnect(); - next(); - }); - }, - - 'test sending unicode': function (next) { - var socket = create(); - - socket.on('error', function (msg) { - throw new Error(msg || 'Received an error'); - }); - - socket.json.send({ test: "☃" }); - - socket.on('done', function () { - socket.disconnect(); - next(); - }); - }, - - 'test webworker connection': function (next) { - if (!window.Worker) { - return next(); - } - - var worker = new Worker('/test/worker.js'); - worker.postMessage(uri()); - worker.onmessage = function (ev) { - if ('done!' == ev.data) return next(); - throw new Error('Unexpected message: ' + ev.data); - } - } - - }; - -})( - 'undefined' == typeof module ? module = {} : module - , 'undefined' == typeof io ? require('socket.io-client') : io - , 'undefined' == typeof should ? require('should-browser') : should -); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/util.test.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/util.test.js deleted file mode 100644 index 30db5a63..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/util.test.js +++ /dev/null @@ -1,156 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -(function (module, io, should) { - - module.exports = { - - 'parse uri': function () { - var http = io.util.parseUri('http://google.com') - , https = io.util.parseUri('https://www.google.com:80') - , query = io.util.parseUri('google.com:8080/foo/bar?foo=bar'); - - http.protocol.should().eql('http'); - http.port.should().eql(''); - http.host.should().eql('google.com'); - https.protocol.should().eql('https'); - https.port.should().eql('80'); - https.host.should().eql('www.google.com'); - query.port.should().eql('8080'); - query.query.should().eql('foo=bar'); - query.path.should().eql('/foo/bar'); - query.relative.should().eql('/foo/bar?foo=bar'); - }, - - 'unique uri': function () { - var protocol = io.util.parseUri('http://google.com') - , noprotocol = io.util.parseUri('google.com') - , https = io.util.parseUri('https://google.com') - , path = io.util.parseUri('https://google.com/google.com/com/?foo=bar'); - - if ('object' == typeof window) { - io.util.uniqueUri(protocol).should().eql('http://google.com:3000'); - io.util.uniqueUri(noprotocol).should().eql('http://google.com:3000'); - } else { - io.util.uniqueUri(protocol).should().eql('http://google.com:80'); - io.util.uniqueUri(noprotocol).should().eql('http://google.com:80'); - } - - io.util.uniqueUri(https).should().eql('https://google.com:443'); - io.util.uniqueUri(path).should().eql('https://google.com:443'); - }, - - 'chunk query string': function () { - io.util.chunkQuery('foo=bar').should().be.a('object'); - io.util.chunkQuery('foo=bar').foo.should().eql('bar'); - }, - - 'merge query strings': function () { - var base = io.util.query('foo=bar', 'foo=baz') - , add = io.util.query('foo=bar', 'bar=foo') - - base.should().eql('?foo=baz'); - add.should().eql('?foo=bar&bar=foo'); - - io.util.query('','').should().eql(''); - io.util.query('foo=bar', '').should().eql('?foo=bar'); - io.util.query('', 'foo=bar').should().eql('?foo=bar'); - }, - - 'request': function () { - var type = typeof io.util.request(); - type.should().eql('object'); - }, - - 'is array': function () { - io.util.isArray([]).should().be_true; - io.util.isArray({}).should().be_false; - io.util.isArray('str').should().be_false; - io.util.isArray(new Date).should().be_false; - io.util.isArray(true).should().be_false; - io.util.isArray(arguments).should().be_false; - }, - - 'merge, deep merge': function () { - var start = { - foo: 'bar' - , bar: 'baz' - } - , duplicate = { - foo: 'foo' - , bar: 'bar' - } - , extra = { - ping: 'pong' - } - , deep = { - level1:{ - foo: 'bar' - , level2: { - foo: 'bar' - , level3:{ - foo: 'bar' - , rescursive: deep - } - } - } - } - // same structure, but changed names - , deeper = { - foo: 'bar' - , level1:{ - foo: 'baz' - , level2: { - foo: 'foo' - , level3:{ - foo: 'pewpew' - , rescursive: deep - } - } - } - }; - - io.util.merge(start, duplicate); - - start.foo.should().eql('foo'); - start.bar.should().eql('bar'); - - io.util.merge(start, extra); - start.ping.should().eql('pong'); - start.foo.should().eql('foo'); - - io.util.merge(deep, deeper); - - deep.foo.should().eql('bar'); - deep.level1.foo.should().eql('baz'); - deep.level1.level2.foo.should().eql('foo'); - deep.level1.level2.level3.foo.should().eql('pewpew'); - }, - - 'defer': function (next) { - var now = +new Date; - - io.util.defer(function () { - ((new Date - now) >= ( io.util.webkit ? 100 : 0 )).should().be_true(); - next(); - }) - }, - - 'indexOf': function () { - var data = ['socket', 2, 3, 4, 'socket', 5, 6, 7, 'io']; - io.util.indexOf(data, 'socket', 1).should().eql(4); - io.util.indexOf(data, 'socket').should().eql(0); - io.util.indexOf(data, 'waffles').should().eql(-1); - } - - }; - -})( - 'undefined' == typeof module ? module = {} : module - , 'undefined' == typeof io ? require('socket.io-client') : io - , 'undefined' == typeof should ? require('should') : should -); diff --git a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/worker.js b/realtime/node_modules/socket.io/node_modules/socket.io-client/test/worker.js deleted file mode 100644 index c5426326..00000000 --- a/realtime/node_modules/socket.io/node_modules/socket.io-client/test/worker.js +++ /dev/null @@ -1,20 +0,0 @@ -importScripts('/socket.io/socket.io.js'); - -self.onmessage = function (ev) { - var url = ev.data - , socket = io.connect(url); - - socket.on('done', function () { - self.postMessage('done!'); - }); - - socket.on('connect_failed', function () { - self.postMessage('connect failed'); - }); - - socket.on('error', function () { - self.postMessage('error'); - }); - - socket.send('woot'); -} diff --git a/realtime/node_modules/socket.io/package.json b/realtime/node_modules/socket.io/package.json deleted file mode 100644 index 865636ed..00000000 --- a/realtime/node_modules/socket.io/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "socket.io", - "version": "0.9.12", - "description": "Real-time apps made cross-browser & easy with a WebSocket-like API", - "homepage": "http://socket.io", - "keywords": [ - "websocket", - "socket", - "realtime", - "socket.io", - "comet", - "ajax" - ], - "author": { - "name": "Guillermo Rauch", - "email": "guillermo@learnboost.com" - }, - "contributors": [ - { - "name": "Guillermo Rauch", - "email": "rauchg@gmail.com" - }, - { - "name": "Arnout Kazemier", - "email": "info@3rd-eden.com" - }, - { - "name": "Vladimir Dronnikov", - "email": "dronnikov@gmail.com" - }, - { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/LearnBoost/socket.io.git" - }, - "dependencies": { - "socket.io-client": "0.9.11", - "policyfile": "0.0.4", - "redis": "0.7.3" - }, - "devDependencies": { - "expresso": "0.9.2", - "should": "*", - "benchmark": "0.2.2", - "microtime": "0.1.3-1", - "colors": "0.5.1" - }, - "optionalDependencies": { - "redis": "0.7.3" - }, - "main": "index", - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "test": "make test" - }, - "_id": "socket.io@0.9.12", - "_engineSupported": true, - "_npmVersion": "1.1.21", - "_nodeVersion": "v0.6.18", - "_defaultsLoaded": true, - "dist": { - "shasum": "f1e52c14182af7aa5511303d6f6f475ff222e70a" - }, - "_from": "socket.io@0.9.12" -} diff --git a/realtime/package.json b/realtime/package.json index cc5448ee..a105a313 100644 --- a/realtime/package.json +++ b/realtime/package.json @@ -4,7 +4,5 @@ "version": "0.0.1", "dependencies": { "socket.io": "0.9.12", - "redis": "0.7.3", - "express": "3.4.8" } }