integrating basic websocket
This commit is contained in:
53
bkp/node_modules/parseurl/HISTORY.md
generated
vendored
Executable file
53
bkp/node_modules/parseurl/HISTORY.md
generated
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
1.3.2 / 2017-09-09
|
||||
==================
|
||||
|
||||
* perf: reduce overhead for full URLs
|
||||
* perf: unroll the "fast-path" `RegExp`
|
||||
|
||||
1.3.1 / 2016-01-17
|
||||
==================
|
||||
|
||||
* perf: enable strict mode
|
||||
|
||||
1.3.0 / 2014-08-09
|
||||
==================
|
||||
|
||||
* Add `parseurl.original` for parsing `req.originalUrl` with fallback
|
||||
* Return `undefined` if `req.url` is `undefined`
|
||||
|
||||
1.2.0 / 2014-07-21
|
||||
==================
|
||||
|
||||
* Cache URLs based on original value
|
||||
* Remove no-longer-needed URL mis-parse work-around
|
||||
* Simplify the "fast-path" `RegExp`
|
||||
|
||||
1.1.3 / 2014-07-08
|
||||
==================
|
||||
|
||||
* Fix typo
|
||||
|
||||
1.1.2 / 2014-07-08
|
||||
==================
|
||||
|
||||
* Seriously fix Node.js 0.8 compatibility
|
||||
|
||||
1.1.1 / 2014-07-08
|
||||
==================
|
||||
|
||||
* Fix Node.js 0.8 compatibility
|
||||
|
||||
1.1.0 / 2014-07-08
|
||||
==================
|
||||
|
||||
* Incorporate URL href-only parse fast-path
|
||||
|
||||
1.0.1 / 2014-03-08
|
||||
==================
|
||||
|
||||
* Add missing `require`
|
||||
|
||||
1.0.0 / 2014-03-08
|
||||
==================
|
||||
|
||||
* Genesis from `connect`
|
24
bkp/node_modules/parseurl/LICENSE
generated
vendored
Executable file
24
bkp/node_modules/parseurl/LICENSE
generated
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014-2017 Douglas Christopher Wilson <doug@somethingdoug.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.
|
124
bkp/node_modules/parseurl/README.md
generated
vendored
Executable file
124
bkp/node_modules/parseurl/README.md
generated
vendored
Executable file
@ -0,0 +1,124 @@
|
||||
# parseurl
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Parse a URL with memoization.
|
||||
|
||||
## Install
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install parseurl
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var parseurl = require('parseurl')
|
||||
```
|
||||
|
||||
### parseurl(req)
|
||||
|
||||
Parse the URL of the given request object (looks at the `req.url` property)
|
||||
and return the result. The result is the same as `url.parse` in Node.js core.
|
||||
Calling this function multiple times on the same `req` where `req.url` does
|
||||
not change will return a cached parsed object, rather than parsing again.
|
||||
|
||||
### parseurl.original(req)
|
||||
|
||||
Parse the original URL of the given request object and return the result.
|
||||
This works by trying to parse `req.originalUrl` if it is a string, otherwise
|
||||
parses `req.url`. The result is the same as `url.parse` in Node.js core.
|
||||
Calling this function multiple times on the same `req` where `req.originalUrl`
|
||||
does not change will return a cached parsed object, rather than parsing again.
|
||||
|
||||
## Benchmark
|
||||
|
||||
```bash
|
||||
$ npm run-script bench
|
||||
|
||||
> parseurl@1.3.2 bench nodejs-parseurl
|
||||
> node benchmark/index.js
|
||||
|
||||
http_parser@2.7.0
|
||||
node@4.8.4
|
||||
v8@4.5.103.47
|
||||
uv@1.9.1
|
||||
zlib@1.2.11
|
||||
ares@1.10.1-DEV
|
||||
icu@56.1
|
||||
modules@46
|
||||
openssl@1.0.2k
|
||||
|
||||
> node benchmark/fullurl.js
|
||||
|
||||
Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy"
|
||||
|
||||
3 tests completed.
|
||||
|
||||
fasturl x 1,246,766 ops/sec ±0.74% (188 runs sampled)
|
||||
nativeurl x 91,536 ops/sec ±0.54% (189 runs sampled)
|
||||
parseurl x 90,645 ops/sec ±0.38% (189 runs sampled)
|
||||
|
||||
> node benchmark/pathquery.js
|
||||
|
||||
Parsing URL "/foo/bar?user=tj&pet=fluffy"
|
||||
|
||||
3 tests completed.
|
||||
|
||||
fasturl x 2,077,650 ops/sec ±0.69% (186 runs sampled)
|
||||
nativeurl x 638,669 ops/sec ±0.67% (189 runs sampled)
|
||||
parseurl x 2,431,842 ops/sec ±0.71% (189 runs sampled)
|
||||
|
||||
> node benchmark/samerequest.js
|
||||
|
||||
Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object
|
||||
|
||||
3 tests completed.
|
||||
|
||||
fasturl x 2,135,391 ops/sec ±0.69% (188 runs sampled)
|
||||
nativeurl x 672,809 ops/sec ±3.83% (186 runs sampled)
|
||||
parseurl x 11,604,947 ops/sec ±0.70% (189 runs sampled)
|
||||
|
||||
> node benchmark/simplepath.js
|
||||
|
||||
Parsing URL "/foo/bar"
|
||||
|
||||
3 tests completed.
|
||||
|
||||
fasturl x 4,961,391 ops/sec ±0.97% (186 runs sampled)
|
||||
nativeurl x 914,931 ops/sec ±0.83% (186 runs sampled)
|
||||
parseurl x 7,559,196 ops/sec ±0.66% (188 runs sampled)
|
||||
|
||||
> node benchmark/slash.js
|
||||
|
||||
Parsing URL "/"
|
||||
|
||||
3 tests completed.
|
||||
|
||||
fasturl x 4,053,379 ops/sec ±0.91% (187 runs sampled)
|
||||
nativeurl x 963,999 ops/sec ±0.58% (189 runs sampled)
|
||||
parseurl x 11,516,143 ops/sec ±0.58% (188 runs sampled)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/parseurl.svg
|
||||
[npm-url]: https://npmjs.org/package/parseurl
|
||||
[node-version-image]: https://img.shields.io/node/v/parseurl.svg
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[travis-image]: https://img.shields.io/travis/pillarjs/parseurl/master.svg
|
||||
[travis-url]: https://travis-ci.org/pillarjs/parseurl
|
||||
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/parseurl/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/parseurl?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/parseurl.svg
|
||||
[downloads-url]: https://npmjs.org/package/parseurl
|
154
bkp/node_modules/parseurl/index.js
generated
vendored
Executable file
154
bkp/node_modules/parseurl/index.js
generated
vendored
Executable file
@ -0,0 +1,154 @@
|
||||
/*!
|
||||
* parseurl
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var url = require('url')
|
||||
var parse = url.parse
|
||||
var Url = url.Url
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = parseurl
|
||||
module.exports.original = originalurl
|
||||
|
||||
/**
|
||||
* Parse the `req` url with memoization.
|
||||
*
|
||||
* @param {ServerRequest} req
|
||||
* @return {Object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parseurl (req) {
|
||||
var url = req.url
|
||||
|
||||
if (url === undefined) {
|
||||
// URL is undefined
|
||||
return undefined
|
||||
}
|
||||
|
||||
var parsed = req._parsedUrl
|
||||
|
||||
if (fresh(url, parsed)) {
|
||||
// Return cached URL parse
|
||||
return parsed
|
||||
}
|
||||
|
||||
// Parse the URL
|
||||
parsed = fastparse(url)
|
||||
parsed._raw = url
|
||||
|
||||
return (req._parsedUrl = parsed)
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the `req` original url with fallback and memoization.
|
||||
*
|
||||
* @param {ServerRequest} req
|
||||
* @return {Object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function originalurl (req) {
|
||||
var url = req.originalUrl
|
||||
|
||||
if (typeof url !== 'string') {
|
||||
// Fallback
|
||||
return parseurl(req)
|
||||
}
|
||||
|
||||
var parsed = req._parsedOriginalUrl
|
||||
|
||||
if (fresh(url, parsed)) {
|
||||
// Return cached URL parse
|
||||
return parsed
|
||||
}
|
||||
|
||||
// Parse the URL
|
||||
parsed = fastparse(url)
|
||||
parsed._raw = url
|
||||
|
||||
return (req._parsedOriginalUrl = parsed)
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the `str` url with fast-path short-cut.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {Object}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function fastparse (str) {
|
||||
if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) {
|
||||
return parse(str)
|
||||
}
|
||||
|
||||
var pathname = str
|
||||
var query = null
|
||||
var search = null
|
||||
|
||||
// This takes the regexp from https://github.com/joyent/node/pull/7878
|
||||
// Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/
|
||||
// And unrolls it into a for loop
|
||||
for (var i = 1; i < str.length; i++) {
|
||||
switch (str.charCodeAt(i)) {
|
||||
case 0x3f: /* ? */
|
||||
if (search === null) {
|
||||
pathname = str.substring(0, i)
|
||||
query = str.substring(i + 1)
|
||||
search = str.substring(i)
|
||||
}
|
||||
break
|
||||
case 0x09: /* \t */
|
||||
case 0x0a: /* \n */
|
||||
case 0x0c: /* \f */
|
||||
case 0x0d: /* \r */
|
||||
case 0x20: /* */
|
||||
case 0x23: /* # */
|
||||
case 0xa0:
|
||||
case 0xfeff:
|
||||
return parse(str)
|
||||
}
|
||||
}
|
||||
|
||||
var url = Url !== undefined
|
||||
? new Url()
|
||||
: {}
|
||||
url.path = str
|
||||
url.href = str
|
||||
url.pathname = pathname
|
||||
url.query = query
|
||||
url.search = search
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if parsed is still fresh for url.
|
||||
*
|
||||
* @param {string} url
|
||||
* @param {object} parsedUrl
|
||||
* @return {boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function fresh (url, parsedUrl) {
|
||||
return typeof parsedUrl === 'object' &&
|
||||
parsedUrl !== null &&
|
||||
(Url === undefined || parsedUrl instanceof Url) &&
|
||||
parsedUrl._raw === url
|
||||
}
|
81
bkp/node_modules/parseurl/package.json
generated
vendored
Executable file
81
bkp/node_modules/parseurl/package.json
generated
vendored
Executable file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"_from": "parseurl@~1.3.2",
|
||||
"_id": "parseurl@1.3.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=",
|
||||
"_location": "/parseurl",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "parseurl@~1.3.2",
|
||||
"name": "parseurl",
|
||||
"escapedName": "parseurl",
|
||||
"rawSpec": "~1.3.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.3.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/express",
|
||||
"/finalhandler",
|
||||
"/serve-static"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
|
||||
"_shasum": "fc289d4ed8993119460c156253262cdc8de65bf3",
|
||||
"_spec": "parseurl@~1.3.2",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/express",
|
||||
"bugs": {
|
||||
"url": "https://github.com/pillarjs/parseurl/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "parse a url with memoization",
|
||||
"devDependencies": {
|
||||
"beautify-benchmark": "0.2.4",
|
||||
"benchmark": "2.1.4",
|
||||
"eslint": "3.19.0",
|
||||
"eslint-config-standard": "10.2.1",
|
||||
"eslint-plugin-import": "2.7.0",
|
||||
"eslint-plugin-node": "5.1.1",
|
||||
"eslint-plugin-promise": "3.5.0",
|
||||
"eslint-plugin-standard": "3.0.1",
|
||||
"fast-url-parser": "1.1.3",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "2.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/pillarjs/parseurl#readme",
|
||||
"license": "MIT",
|
||||
"name": "parseurl",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pillarjs/parseurl.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node benchmark/index.js",
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --check-leaks --bail --reporter spec test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/"
|
||||
},
|
||||
"version": "1.3.2"
|
||||
}
|
Reference in New Issue
Block a user