You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1130 lines
37 KiB
1130 lines
37 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Source: http/base.js</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">Source: http/base.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>/*!
|
|
* http.js - http server for bcoin
|
|
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
|
|
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
|
|
* https://github.com/bcoin-org/bcoin
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var assert = require('assert');
|
|
var AsyncObject = require('../utils/asyncobject');
|
|
var util = require('../utils/util');
|
|
var URL = require('url');
|
|
var co = require('../utils/co');
|
|
|
|
/**
|
|
* HTTPBase
|
|
* @alias module:http.Base
|
|
* @constructor
|
|
* @param {Object?} options
|
|
* @emits HTTPBase#websocket
|
|
*/
|
|
|
|
function HTTPBase(options) {
|
|
if (!(this instanceof HTTPBase))
|
|
return new HTTPBase(options);
|
|
|
|
AsyncObject.call(this);
|
|
|
|
this.options = new HTTPBaseOptions(options);
|
|
|
|
this.server = null;
|
|
this.io = null;
|
|
this.routes = new Routes();
|
|
this.stack = [];
|
|
this.hooks = [];
|
|
|
|
this._init();
|
|
}
|
|
|
|
util.inherits(HTTPBase, AsyncObject);
|
|
|
|
/**
|
|
* Initialize server.
|
|
* @private
|
|
*/
|
|
|
|
HTTPBase.prototype._init = function _init() {
|
|
var self = this;
|
|
var backend = this.options.getBackend();
|
|
var options = this.options.toHTTP();
|
|
|
|
this.server = backend.createServer(options);
|
|
|
|
this._initRouter();
|
|
this._initIO();
|
|
|
|
this.server.on('connection', function(socket) {
|
|
socket.on('error', function(err) {
|
|
var str;
|
|
|
|
if (err.message === 'Parse Error') {
|
|
str = 'http_parser.execute failure (';
|
|
str += 'parsed=' + (err.bytesParsed || -1);
|
|
str += ' code=' + err.code;
|
|
str += ')';
|
|
err = new Error(str);
|
|
}
|
|
|
|
self.emit('error', err);
|
|
|
|
try {
|
|
socket.destroy();
|
|
} catch (e) {
|
|
;
|
|
}
|
|
});
|
|
});
|
|
|
|
this.server.on('error', function(err) {
|
|
self.emit('error', err);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Initialize router.
|
|
* @private
|
|
*/
|
|
|
|
HTTPBase.prototype._initRouter = function _initRouter() {
|
|
var self = this;
|
|
this.server.on('request', co(function* (req, res) {
|
|
try {
|
|
yield self.handleRequest(req, res);
|
|
} catch (e) {
|
|
if (!res.sent)
|
|
res.error(e);
|
|
|
|
self.emit('error', e);
|
|
}
|
|
}));
|
|
};
|
|
|
|
/**
|
|
* Handle a request.
|
|
* @private
|
|
* @param {ServerRequest} req
|
|
* @param {ServerResponse} res
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype.handleRequest = co(function* handleRequest(req, res) {
|
|
var i, routes, route, params;
|
|
|
|
initRequest(req, res, this.options.keyLimit);
|
|
|
|
this.emit('request', req, res);
|
|
|
|
if (yield this.handleStack(req, res))
|
|
return;
|
|
|
|
req.body = yield this.parseBody(req);
|
|
|
|
routes = this.routes.getHandlers(req.method);
|
|
|
|
if (!routes)
|
|
throw new Error('No routes found for method: ' + req.method);
|
|
|
|
for (i = 0; i < routes.length; i++) {
|
|
route = routes[i];
|
|
params = route.match(req.pathname);
|
|
|
|
if (!params)
|
|
continue;
|
|
|
|
req.params = params;
|
|
|
|
if (yield this.handleHooks(req, res))
|
|
return;
|
|
|
|
if (yield route.call(req, res))
|
|
return;
|
|
}
|
|
|
|
throw new Error('No routes found for path: ' + req.pathname);
|
|
});
|
|
|
|
/**
|
|
* Parse request body.
|
|
* @private
|
|
* @param {ServerRequest} req
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype.parseBody = co(function* parseBody(req) {
|
|
var body = Object.create(null);
|
|
var data;
|
|
|
|
if (req.method === 'GET')
|
|
return body;
|
|
|
|
data = yield this.readBody(req, 'utf8');
|
|
|
|
if (!data)
|
|
return body;
|
|
|
|
switch (req.contentType) {
|
|
case 'json':
|
|
body = JSON.parse(data);
|
|
break;
|
|
case 'form':
|
|
body = parsePairs(data, this.options.keyLimit);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return body;
|
|
});
|
|
|
|
/**
|
|
* Read and buffer request body.
|
|
* @param {ServerRequest} req
|
|
* @param {String} enc
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype.readBody = function readBody(req, enc) {
|
|
var self = this;
|
|
return new Promise(function(resolve, reject) {
|
|
return self._readBody(req, enc, resolve, reject);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Read and buffer request body.
|
|
* @private
|
|
* @param {ServerRequest} req
|
|
* @param {String} enc
|
|
* @param {Function} resolve
|
|
* @param {Function} reject
|
|
*/
|
|
|
|
HTTPBase.prototype._readBody = function _readBody(req, enc, resolve, reject) {
|
|
var self = this;
|
|
var StringDecoder = require('string_decoder').StringDecoder;
|
|
var decode = new StringDecoder(enc);
|
|
var hasData = false;
|
|
var total = 0;
|
|
var body = '';
|
|
var timer;
|
|
|
|
timer = setTimeout(function() {
|
|
timer = null;
|
|
cleanup();
|
|
reject(new Error('Request body timed out.'));
|
|
}, 10 * 1000);
|
|
|
|
function cleanup() {
|
|
req.removeListener('data', onData);
|
|
req.removeListener('error', onError);
|
|
req.removeListener('end', onEnd);
|
|
|
|
if (timer != null) {
|
|
timer = null;
|
|
clearTimeout(timer);
|
|
}
|
|
}
|
|
|
|
function onData(data) {
|
|
total += data.length;
|
|
hasData = true;
|
|
|
|
if (total > self.options.bodyLimit) {
|
|
reject(new Error('Request body overflow.'));
|
|
return;
|
|
}
|
|
|
|
body += decode.write(data);
|
|
}
|
|
|
|
function onError(err) {
|
|
cleanup();
|
|
reject(err);
|
|
}
|
|
|
|
function onEnd() {
|
|
cleanup();
|
|
|
|
if (hasData) {
|
|
resolve(body);
|
|
return;
|
|
}
|
|
|
|
resolve(null);
|
|
}
|
|
|
|
req.on('data', onData);
|
|
req.on('error', onError);
|
|
req.on('end', onEnd);
|
|
};
|
|
|
|
/**
|
|
* Handle middleware stack.
|
|
* @private
|
|
* @param {HTTPRequest} req
|
|
* @param {HTTPResponse} res
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype.handleStack = co(function* handleStack(req, res) {
|
|
var i, route;
|
|
|
|
for (i = 0; i < this.stack.length; i++) {
|
|
route = this.stack[i];
|
|
|
|
if (!route.hasPrefix(req.pathname))
|
|
continue;
|
|
|
|
if (yield route.call(req, res))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
/**
|
|
* Handle hook stack.
|
|
* @private
|
|
* @param {HTTPRequest} req
|
|
* @param {HTTPResponse} res
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype.handleHooks = co(function* handleHooks(req, res) {
|
|
var i, route;
|
|
|
|
for (i = 0; i < this.hooks.length; i++) {
|
|
route = this.hooks[i];
|
|
|
|
if (!route.hasPrefix(req.pathname))
|
|
continue;
|
|
|
|
if (yield route.call(req, res))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
/**
|
|
* Initialize websockets.
|
|
* @private
|
|
*/
|
|
|
|
HTTPBase.prototype._initIO = function _initIO() {
|
|
var self = this;
|
|
var IOServer;
|
|
|
|
if (!this.options.sockets)
|
|
return;
|
|
|
|
try {
|
|
IOServer = require('socket.io');
|
|
} catch (e) {
|
|
;
|
|
}
|
|
|
|
if (!IOServer)
|
|
return;
|
|
|
|
this.io = new IOServer({
|
|
transports: ['websocket']
|
|
});
|
|
|
|
this.io.attach(this.server);
|
|
|
|
this.io.on('connection', function(socket) {
|
|
self.emit('websocket', socket);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Open the server.
|
|
* @alias HTTPBase#open
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype._open = function open() {
|
|
return this.listen(this.options.port, this.options.host);
|
|
};
|
|
|
|
/**
|
|
* Close the server.
|
|
* @alias HTTPBase#close
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype._close = function close() {
|
|
var self = this;
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
if (self.io) {
|
|
self.server.once('close', resolve);
|
|
self.io.close();
|
|
return;
|
|
}
|
|
|
|
self.server.close(function(err) {
|
|
if (err) {
|
|
reject(err);
|
|
return;
|
|
}
|
|
resolve();
|
|
});
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Add a middleware to the stack.
|
|
* @param {String?} path
|
|
* @param {Function} handler
|
|
* @param {Object?} ctx
|
|
*/
|
|
|
|
HTTPBase.prototype.use = function use(path, handler, ctx) {
|
|
if (!handler) {
|
|
handler = path;
|
|
path = null;
|
|
}
|
|
this.stack.push(new Route(ctx, path, handler));
|
|
};
|
|
|
|
/**
|
|
* Add a hook to the stack.
|
|
* @param {String?} path
|
|
* @param {Function} handler
|
|
* @param {Object?} ctx
|
|
*/
|
|
|
|
HTTPBase.prototype.hook = function hook(path, handler, ctx) {
|
|
if (!handler) {
|
|
handler = path;
|
|
path = null;
|
|
}
|
|
this.hooks.push(new Route(ctx, path, handler));
|
|
};
|
|
|
|
/**
|
|
* Add a GET route.
|
|
* @param {String} path
|
|
* @param {Function} handler
|
|
* @param {Object?} ctx
|
|
*/
|
|
|
|
HTTPBase.prototype.get = function get(path, handler, ctx) {
|
|
this.routes.get.push(new Route(ctx, path, handler));
|
|
};
|
|
|
|
/**
|
|
* Add a POST route.
|
|
* @param {String} path
|
|
* @param {Function} handler
|
|
* @param {Object?} ctx
|
|
*/
|
|
|
|
HTTPBase.prototype.post = function post(path, handler, ctx) {
|
|
this.routes.post.push(new Route(ctx, path, handler));
|
|
};
|
|
|
|
/**
|
|
* Add a PUT route.
|
|
* @param {String} path
|
|
* @param {Function} handler
|
|
* @param {Object?} ctx
|
|
*/
|
|
|
|
HTTPBase.prototype.put = function put(path, handler, ctx) {
|
|
this.routes.put.push(new Route(ctx, path, handler));
|
|
};
|
|
|
|
/**
|
|
* Add a DELETE route.
|
|
* @param {String} path
|
|
* @param {Function} handler
|
|
* @param {Object?} ctx
|
|
*/
|
|
|
|
HTTPBase.prototype.del = function del(path, handler, ctx) {
|
|
this.routes.del.push(new Route(ctx, path, handler));
|
|
};
|
|
|
|
/**
|
|
* Get server address.
|
|
* @returns {Object}
|
|
*/
|
|
|
|
HTTPBase.prototype.address = function address() {
|
|
return this.server.address();
|
|
};
|
|
|
|
/**
|
|
* Listen on port and host.
|
|
* @param {Number} port
|
|
* @param {String} host
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
HTTPBase.prototype.listen = function listen(port, host) {
|
|
var self = this;
|
|
return new Promise(function(resolve, reject) {
|
|
var addr;
|
|
|
|
self.server.listen(port, host, function(err) {
|
|
if (err)
|
|
return reject(err);
|
|
|
|
addr = self.address();
|
|
|
|
self.emit('listening', addr);
|
|
|
|
resolve(addr);
|
|
});
|
|
});
|
|
};
|
|
|
|
/**
|
|
* HTTP Base Options
|
|
* @alias module:http.HTTPBaseOptions
|
|
* @constructor
|
|
* @param {Object} options
|
|
*/
|
|
|
|
function HTTPBaseOptions(options) {
|
|
if (!(this instanceof HTTPBaseOptions))
|
|
return new HTTPBaseOptions(options);
|
|
|
|
this.host = '127.0.0.1';
|
|
this.port = 8080;
|
|
this.sockets = false;
|
|
|
|
this.ssl = false;
|
|
this.key = null;
|
|
this.cert = null;
|
|
this.ca = null;
|
|
|
|
this.keyLimit = 100;
|
|
this.bodyLimit = 20 << 20;
|
|
|
|
if (options)
|
|
this.fromOptions(options);
|
|
}
|
|
|
|
/**
|
|
* Inject properties from object.
|
|
* @private
|
|
* @param {Object} options
|
|
* @returns {HTTPBaseOptions}
|
|
*/
|
|
|
|
HTTPBaseOptions.prototype.fromOptions = function fromOptions(options) {
|
|
assert(options);
|
|
|
|
if (options.host != null) {
|
|
assert(typeof options.host === 'string');
|
|
this.host = options.host;
|
|
}
|
|
|
|
if (options.port != null) {
|
|
assert(typeof options.port === 'number', 'Port must be a number.');
|
|
assert(options.port > 0 && options.port <= 0xffff);
|
|
this.port = options.port;
|
|
}
|
|
|
|
if (options.sockets != null) {
|
|
assert(typeof options.sockets === 'boolean');
|
|
this.sockets = options.sockets;
|
|
}
|
|
|
|
if (options.key != null) {
|
|
assert(typeof options.key === 'string' || Buffer.isBuffer(options.key));
|
|
this.key = options.key;
|
|
this.ssl = true;
|
|
}
|
|
|
|
if (options.cert != null) {
|
|
assert(typeof options.cert === 'string' || Buffer.isBuffer(options.cert));
|
|
this.cert = options.cert;
|
|
}
|
|
|
|
if (options.ca != null) {
|
|
assert(Array.isArray(options.ca));
|
|
this.ca = options.ca;
|
|
}
|
|
|
|
if (options.keyLimit != null) {
|
|
assert(typeof options.keyLimit === 'number');
|
|
this.keyLimit = options.keyLimit;
|
|
}
|
|
|
|
if (options.bodyLimit != null) {
|
|
assert(typeof options.bodyLimit === 'number');
|
|
this.bodyLimit = options.bodyLimit;
|
|
}
|
|
|
|
if (options.ssl != null) {
|
|
assert(typeof options.ssl === 'boolean');
|
|
assert(this.key, 'SSL specified with no provided key.');
|
|
this.ssl = options.ssl;
|
|
}
|
|
|
|
return this;
|
|
};
|
|
|
|
/**
|
|
* Instantiate http server options from object.
|
|
* @param {Object} options
|
|
* @returns {HTTPBaseOptions}
|
|
*/
|
|
|
|
HTTPBaseOptions.fromOptions = function fromOptions(options) {
|
|
return new HTTPBaseOptions().fromOptions(options);
|
|
};
|
|
|
|
/**
|
|
* Get HTTP server backend.
|
|
* @private
|
|
* @returns {Object}
|
|
*/
|
|
|
|
HTTPBaseOptions.prototype.getBackend = function getBackend() {
|
|
return this.ssl ? require('https') : require('http');
|
|
};
|
|
|
|
/**
|
|
* Get HTTP server options.
|
|
* @private
|
|
* @returns {Object}
|
|
*/
|
|
|
|
HTTPBaseOptions.prototype.toHTTP = function toHTTP() {
|
|
if (!this.ssl)
|
|
return undefined;
|
|
|
|
return {
|
|
key: this.key,
|
|
cert: this.cert,
|
|
ca: this.ca
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Route
|
|
* @constructor
|
|
* @ignore
|
|
*/
|
|
|
|
function Route(ctx, path, handler) {
|
|
if (!(this instanceof Route))
|
|
return new Route(ctx, path, handler);
|
|
|
|
this.ctx = null;
|
|
this.path = null;
|
|
this.handler = null;
|
|
|
|
this.regex = /^/;
|
|
this.map = [];
|
|
this.compiled = false;
|
|
|
|
if (ctx) {
|
|
assert(typeof ctx === 'object');
|
|
this.ctx = ctx;
|
|
}
|
|
|
|
if (path) {
|
|
if (path instanceof RegExp) {
|
|
this.regex = path;
|
|
} else {
|
|
assert(typeof path === 'string');
|
|
assert(path.length > 0);
|
|
this.path = path;
|
|
}
|
|
}
|
|
|
|
assert(typeof handler === 'function');
|
|
this.handler = handler;
|
|
}
|
|
|
|
Route.prototype.compile = function compile() {
|
|
var path = this.path;
|
|
var map = this.map;
|
|
|
|
if (this.compiled)
|
|
return;
|
|
|
|
this.compiled = true;
|
|
|
|
if (!path)
|
|
return;
|
|
|
|
path = path.replace(/(\/[^\/]+)\?/g, '(?:$1)?');
|
|
path = path.replace(/\.(?!\+)/g, '\\.');
|
|
path = path.replace(/\*/g, '.*?');
|
|
path = path.replace(/%/g, '\\');
|
|
|
|
path = path.replace(/:(\w+)/g, function(str, name) {
|
|
map.push(name);
|
|
return '([^/]+)';
|
|
});
|
|
|
|
this.regex = new RegExp('^' + path + '$');
|
|
};
|
|
|
|
Route.prototype.match = function match(pathname) {
|
|
var i, match, item, params, key;
|
|
|
|
this.compile();
|
|
|
|
assert(this.regex);
|
|
|
|
match = this.regex.exec(pathname);
|
|
|
|
if (!match)
|
|
return;
|
|
|
|
params = Object.create(null);
|
|
|
|
for (i = 1; i < match.length; i++) {
|
|
item = match[i];
|
|
key = this.map[i - 1];
|
|
|
|
if (key)
|
|
params[key] = item;
|
|
|
|
params[i - 1] = item;
|
|
}
|
|
|
|
return params;
|
|
};
|
|
|
|
Route.prototype.hasPrefix = function hasPrefix(pathname) {
|
|
if (!this.path)
|
|
return true;
|
|
|
|
return pathname.indexOf(this.path) === 0;
|
|
};
|
|
|
|
Route.prototype.call = co(function* call(req, res) {
|
|
yield this.handler.call(this.ctx, req, res);
|
|
return res.sent;
|
|
});
|
|
|
|
/**
|
|
* Routes
|
|
* @constructor
|
|
* @ignore
|
|
*/
|
|
|
|
function Routes() {
|
|
if (!(this instanceof Routes))
|
|
return new Routes();
|
|
|
|
this.get = [];
|
|
this.post = [];
|
|
this.put = [];
|
|
this.del = [];
|
|
}
|
|
|
|
Routes.prototype.getHandlers = function getHandlers(method) {
|
|
if (!method)
|
|
return;
|
|
|
|
method = method.toUpperCase();
|
|
|
|
switch (method) {
|
|
case 'GET':
|
|
return this.get;
|
|
case 'POST':
|
|
return this.post;
|
|
case 'PUT':
|
|
return this.put;
|
|
case 'DEL':
|
|
return this.del;
|
|
default:
|
|
return;
|
|
}
|
|
};
|
|
|
|
/*
|
|
* Helpers
|
|
*/
|
|
|
|
function nop() {}
|
|
|
|
function initRequest(req, res, limit) {
|
|
var parsed;
|
|
|
|
req.on('error', nop);
|
|
|
|
assert(req.contentType == null);
|
|
assert(req.pathname == null);
|
|
assert(req.path == null);
|
|
assert(req.query == null);
|
|
assert(req.params == null);
|
|
assert(req.body == null);
|
|
|
|
req.contentType = parseType(req.headers['content-type']);
|
|
req.pathname = '';
|
|
req.path = [];
|
|
req.query = Object.create(null);
|
|
req.params = Object.create(null);
|
|
req.body = Object.create(null);
|
|
|
|
assert(req.options == null);
|
|
assert(req.username == null);
|
|
assert(req.password == null);
|
|
assert(req.admin == null);
|
|
assert(req.wallet == null);
|
|
|
|
req.options = Object.create(null);
|
|
req.username = null;
|
|
req.password = null;
|
|
req.admin = false;
|
|
req.wallet = null;
|
|
|
|
assert(res.sent == null);
|
|
assert(res.send == null);
|
|
assert(res.error == null);
|
|
assert(res.redirect == null);
|
|
|
|
res.sent = false;
|
|
res.send = makeSend(res);
|
|
res.error = makeSendError(req, res);
|
|
res.redirect = makeRedirect(res);
|
|
|
|
parsed = parseURL(req.url, limit);
|
|
|
|
req.url = parsed.url;
|
|
req.pathname = parsed.pathname;
|
|
req.path = parsed.parts;
|
|
req.query = parsed.query;
|
|
|
|
return parsed;
|
|
}
|
|
|
|
function makeSend(res) {
|
|
return function send(code, msg, type) {
|
|
return sendResponse(res, code, msg, type);
|
|
};
|
|
}
|
|
|
|
function sendResponse(res, code, msg, type) {
|
|
var len;
|
|
|
|
if (res.sent)
|
|
return;
|
|
|
|
assert(typeof code === 'number', 'Code must be a number.');
|
|
|
|
if (msg == null)
|
|
msg = { error: 'No message.' };
|
|
|
|
if (msg && typeof msg === 'object' && !Buffer.isBuffer(msg)) {
|
|
msg = JSON.stringify(msg, null, 2) + '\n';
|
|
if (!type)
|
|
type = 'json';
|
|
assert(type === 'json', 'Bad type passed with json object.');
|
|
}
|
|
|
|
if (!type)
|
|
type = typeof msg === 'string' ? 'txt' : 'bin';
|
|
|
|
res.statusCode = code;
|
|
res.setHeader('Content-Type', getType(type));
|
|
res.sent = true;
|
|
|
|
if (typeof msg === 'string') {
|
|
len = Buffer.byteLength(msg, 'utf8');
|
|
res.setHeader('Content-Length', len + '');
|
|
try {
|
|
res.write(msg, 'utf8');
|
|
res.end();
|
|
} catch (e) {
|
|
;
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (Buffer.isBuffer(msg)) {
|
|
res.setHeader('Content-Length', msg.length + '');
|
|
try {
|
|
res.write(msg);
|
|
res.end();
|
|
} catch (e) {
|
|
;
|
|
}
|
|
return;
|
|
}
|
|
|
|
assert(false, 'Bad object passed to send.');
|
|
}
|
|
|
|
function makeSendError(req, res) {
|
|
return function error(err) {
|
|
return sendError(req, res, err);
|
|
};
|
|
}
|
|
|
|
function sendError(req, res, err) {
|
|
var code, msg;
|
|
|
|
if (res.sent)
|
|
return;
|
|
|
|
code = err.statusCode;
|
|
msg = err.message;
|
|
|
|
if (!code)
|
|
code = 400;
|
|
|
|
if (typeof msg !== 'string')
|
|
msg += '';
|
|
|
|
res.send(code, { error: msg });
|
|
|
|
try {
|
|
req.destroy();
|
|
req.socket.destroy();
|
|
} catch (e) {
|
|
;
|
|
}
|
|
}
|
|
|
|
function makeRedirect(res) {
|
|
return function redirect(code, url) {
|
|
if (!url) {
|
|
url = code;
|
|
code = 301;
|
|
}
|
|
res.statusCode = code;
|
|
res.setHeader('Location', url);
|
|
res.end();
|
|
};
|
|
}
|
|
|
|
function parsePairs(str, limit) {
|
|
var parts = str.split('&');
|
|
var data = Object.create(null);
|
|
var i, index, pair, key, value;
|
|
|
|
assert(!limit || parts.length <= limit, 'Too many keys in querystring.');
|
|
|
|
for (i = 0; i < parts.length; i++) {
|
|
pair = parts[i];
|
|
index = pair.indexOf('=');
|
|
|
|
if (index === -1) {
|
|
key = pair;
|
|
value = '';
|
|
} else {
|
|
key = pair.substring(0, index);
|
|
value = pair.substring(index + 1);
|
|
}
|
|
|
|
key = unescape(key);
|
|
|
|
if (key.length === 0)
|
|
continue;
|
|
|
|
value = unescape(value);
|
|
|
|
if (value.length === 0)
|
|
continue;
|
|
|
|
data[key] = value;
|
|
}
|
|
|
|
return data;
|
|
}
|
|
|
|
function parseURL(str, limit) {
|
|
var uri = URL.parse(str);
|
|
var parsed = new ParsedURL(str);
|
|
var pathname = uri.pathname;
|
|
var query = Object.create(null);
|
|
var trailing = false;
|
|
var path, parts, url;
|
|
|
|
if (pathname) {
|
|
pathname = pathname.replace(/\/{2,}/g, '/');
|
|
|
|
if (pathname[0] !== '/')
|
|
pathname = '/' + pathname;
|
|
|
|
if (pathname.length > 1) {
|
|
if (pathname[pathname.length - 1] === '/') {
|
|
pathname = pathname.slice(0, -1);
|
|
trailing = true;
|
|
}
|
|
}
|
|
|
|
pathname = unescape(pathname);
|
|
} else {
|
|
pathname = '/';
|
|
}
|
|
|
|
assert(pathname.length > 0);
|
|
assert(pathname[0] === '/');
|
|
|
|
if (pathname.length > 1)
|
|
assert(pathname[pathname.length - 1] !== '/');
|
|
|
|
path = pathname;
|
|
|
|
if (path[0] === '/')
|
|
path = path.substring(1);
|
|
|
|
parts = path.split('/');
|
|
|
|
if (parts.length === 1) {
|
|
if (parts[0].length === 0)
|
|
parts = [];
|
|
}
|
|
|
|
url = pathname;
|
|
|
|
if (uri.search && uri.search.length > 1) {
|
|
assert(uri.search[0] === '?');
|
|
url += uri.search;
|
|
}
|
|
|
|
if (uri.hash && uri.hash.length > 1) {
|
|
assert(uri.hash[0] === '#');
|
|
url += uri.hash;
|
|
}
|
|
|
|
if (uri.query)
|
|
query = parsePairs(uri.query, limit);
|
|
|
|
parsed.url = url;
|
|
parsed.pathname = pathname;
|
|
parsed.parts = parts;
|
|
parsed.query = query;
|
|
parsed.trailing = trailing;
|
|
|
|
return parsed;
|
|
}
|
|
|
|
function ParsedURL(original) {
|
|
this.original = original;
|
|
this.url = null;
|
|
this.pathname = null;
|
|
this.parts = null;
|
|
this.query = null;
|
|
this.trailing = false;
|
|
}
|
|
|
|
function unescape(str) {
|
|
str = decodeURIComponent(str);
|
|
str = str.replace(/\+/g, ' ');
|
|
str = str.replace(/\0/g, '');
|
|
return str;
|
|
}
|
|
|
|
function getType(type) {
|
|
switch (type) {
|
|
case 'json':
|
|
return 'application/json';
|
|
case 'form':
|
|
return 'application/x-www-form-urlencoded; charset=utf-8';
|
|
case 'html':
|
|
return 'text/html; charset=utf-8';
|
|
case 'js':
|
|
return 'application/javascript; charset=utf-8';
|
|
case 'css':
|
|
return 'text/css; charset=utf-8';
|
|
case 'txt':
|
|
return 'text/plain; charset=utf-8';
|
|
case 'bin':
|
|
return 'application/octet-stream';
|
|
default:
|
|
throw new Error('Unknown type: ' + type);
|
|
}
|
|
}
|
|
|
|
function parseType(type) {
|
|
type = type || '';
|
|
type = type.split(';')[0];
|
|
type = type.toLowerCase();
|
|
type = type.trim();
|
|
|
|
switch (type) {
|
|
case 'text/x-json':
|
|
case 'application/json':
|
|
return 'json';
|
|
case 'application/x-www-form-urlencoded':
|
|
return 'form';
|
|
case 'text/html':
|
|
case 'application/xhtml+xml':
|
|
return 'html';
|
|
case 'text/javascript':
|
|
case 'application/javascript':
|
|
return 'js';
|
|
case 'text/css':
|
|
return 'css';
|
|
case 'text/plain':
|
|
return 'txt';
|
|
case 'application/octet-stream':
|
|
return 'bin';
|
|
default:
|
|
return 'bin';
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Expose
|
|
*/
|
|
|
|
module.exports = HTTPBase;
|
|
</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bcoin.html">bcoin</a></li><li><a href="module-bip70.html">bip70</a></li><li><a href="module-bip70_pk.html">bip70/pk</a></li><li><a href="module-bip70_x509.html">bip70/x509</a></li><li><a href="module-blockchain.html">blockchain</a></li><li><a href="module-blockchain_common.html">blockchain/common</a></li><li><a href="module-btc.html">btc</a></li><li><a href="module-coins.html">coins</a></li><li><a href="module-crypto.html">crypto</a></li><li><a href="module-crypto_chachapoly.html">crypto/chachapoly</a></li><li><a href="module-crypto_ec.html">crypto/ec</a></li><li><a href="module-crypto_pk.html">crypto/pk</a></li><li><a href="module-crypto_schnorr.html">crypto/schnorr</a></li><li><a href="module-crypto_siphash.html">crypto/siphash</a></li><li><a href="module-db.html">db</a></li><li><a href="module-hd.html">hd</a></li><li><a href="module-http.html">http</a></li><li><a href="module-mempool.html">mempool</a></li><li><a href="module-mining.html">mining</a></li><li><a href="module-net.html">net</a></li><li><a href="module-net_bip152.html">net/bip152</a></li><li><a href="module-net_common.html">net/common</a></li><li><a href="module-net_dns.html">net/dns</a></li><li><a href="module-net_packets.html">net/packets</a></li><li><a href="module-net_socks.html">net/socks</a></li><li><a href="module-net_tcp.html">net/tcp</a></li><li><a href="module-node.html">node</a></li><li><a href="module-node_config.html">node/config</a></li><li><a href="module-primitives.html">primitives</a></li><li><a href="module-protocol.html">protocol</a></li><li><a href="module-protocol_consensus.html">protocol/consensus</a></li><li><a href="module-protocol_errors.html">protocol/errors</a></li><li><a href="module-protocol_networks.html">protocol/networks</a></li><li><a href="module-protocol_policy.html">protocol/policy</a></li><li><a href="module-script.html">script</a></li><li><a href="module-script_common.html">script/common</a></li><li><a href="module-utils.html">utils</a></li><li><a href="module-utils_asn1.html">utils/asn1</a></li><li><a href="module-utils_base32.html">utils/base32</a></li><li><a href="module-utils_base58.html">utils/base58</a></li><li><a href="module-utils_co.html">utils/co</a></li><li><a href="module-utils_encoding.html">utils/encoding</a></li><li><a href="module-utils_ip.html">utils/ip</a></li><li><a href="module-utils_pem.html">utils/pem</a></li><li><a href="module-utils_protobuf.html">utils/protobuf</a></li><li><a href="module-utils_util.html">utils/util</a></li><li><a href="module-wallet.html">wallet</a></li><li><a href="module-wallet_common.html">wallet/common</a></li><li><a href="module-wallet_records.html">wallet/records</a></li><li><a href="module-workers.html">workers</a></li><li><a href="module-workers_jobs.html">workers/jobs</a></li><li><a href="module-workers_packets.html">workers/packets</a></li></ul><h3>Classes</h3><ul><li><a href="Environment.html">Environment</a></li><li><a href="module-bip70.Payment.html">Payment</a></li><li><a href="module-bip70.PaymentACK.html">PaymentACK</a></li><li><a href="module-bip70.PaymentDetails.html">PaymentDetails</a></li><li><a href="module-bip70.PaymentRequest.html">PaymentRequest</a></li><li><a href="module-blockchain.Chain.html">Chain</a></li><li><a href="module-blockchain.ChainDB.html">ChainDB</a></li><li><a href="module-blockchain.ChainEntry.html">ChainEntry</a></li><li><a href="module-blockchain.ChainFlags.html">ChainFlags</a></li><li><a href="module-blockchain.ChainOptions.html">ChainOptions</a></li><li><a href="module-blockchain.ChainState.html">ChainState</a></li><li><a href="module-blockchain.DeploymentState.html">DeploymentState</a></li><li><a href="module-blockchain.StateCache.html">StateCache</a></li><li><a href="module-btc.Amount.html">Amount</a></li><li><a href="module-btc.URI.html">URI</a></li><li><a href="module-coins.CoinEntry.html">CoinEntry</a></li><li><a href="module-coins.Coins.html">Coins</a></li><li><a href="module-coins.CoinView.html">CoinView</a></li><li><a href="module-coins.UndoCoin.html">UndoCoin</a></li><li><a href="module-coins.UndoCoins.html">UndoCoins</a></li><li><a href="module-crypto_aes.AESCipher.html">AESCipher</a></li><li><a href="module-crypto_aes.AESDecipher.html">AESDecipher</a></li><li><a href="module-crypto_aes.AESKey.html">AESKey</a></li><li><a href="module-crypto_chachapoly.AEAD.html">AEAD</a></li><li><a href="module-crypto_chachapoly.ChaCha20.html">ChaCha20</a></li><li><a href="module-crypto_chachapoly.Poly1305.html">Poly1305</a></li><li><a href="module-crypto_sha256.SHA256.html">SHA256</a></li><li><a href="module-crypto_sha256.SHA256Hmac.html">SHA256Hmac</a></li><li><a href="module-db.LowlevelUp.html">LowlevelUp</a></li><li><a href="module-db.RBT.html">RBT</a></li><li><a href="module-hd.Mnemonic.html">Mnemonic</a></li><li><a href="module-hd.PrivateKey.html">PrivateKey</a></li><li><a href="module-hd.PublicKey.html">PublicKey</a></li><li><a href="module-http.Base.html">Base</a></li><li><a href="module-http.Client.html">Client</a></li><li><a href="module-http.HTTPBaseOptions.html">HTTPBaseOptions</a></li><li><a href="module-http.HTTPOptions.html">HTTPOptions</a></li><li><a href="module-http.Request.html">Request</a></li><li><a href="module-http.RPC.html">RPC</a></li><li><a href="module-http.RPCClient.html">RPCClient</a></li><li><a href="module-http.Server.html">Server</a></li><li><a href="module-http.Wallet.html">Wallet</a></li><li><a href="module-mempool.ConfirmStats.html">ConfirmStats</a></li><li><a href="module-mempool.Mempool.html">Mempool</a></li><li><a href="module-mempool.MempoolEntry.html">MempoolEntry</a></li><li><a href="module-mempool.MempoolOptions.html">MempoolOptions</a></li><li><a href="module-mempool.PolicyEstimator.html">PolicyEstimator</a></li><li><a href="module-mining.BlockEntry.html">BlockEntry</a></li><li><a href="module-mining.Miner.html">Miner</a></li><li><a href="module-mining.MinerBlock.html">MinerBlock</a></li><li><a href="module-mining.MinerOptions.html">MinerOptions</a></li><li><a href="module-net.AuthDB.html">AuthDB</a></li><li><a href="module-net.BIP150.html">BIP150</a></li><li><a href="module-net.BIP151.html">BIP151</a></li><li><a href="module-net.BIP151Stream.html">BIP151Stream</a></li><li><a href="module-net.BroadcastItem.html">BroadcastItem</a></li><li><a href="module-net.Framer.html">Framer</a></li><li><a href="module-net.HostEntry.html">HostEntry</a></li><li><a href="module-net.HostList.html">HostList</a></li><li><a href="module-net.Parser.html">Parser</a></li><li><a href="module-net.Peer.html">Peer</a></li><li><a href="module-net.PeerList.html">PeerList</a></li><li><a href="module-net.PeerOptions.html">PeerOptions</a></li><li><a href="module-net.Pool.html">Pool</a></li><li><a href="module-net.PoolOptions.html">PoolOptions</a></li><li><a href="module-net_bip152-CompactBlock.html">CompactBlock</a></li><li><a href="module-net_bip152-PrefilledTX.html">PrefilledTX</a></li><li><a href="module-net_bip152-TXRequest.html">TXRequest</a></li><li><a href="module-net_bip152-TXResponse.html">TXResponse</a></li><li><a href="module-net_packets-AddrPacket.html">AddrPacket</a></li><li><a href="module-net_packets-AuthChallengePacket.html">AuthChallengePacket</a></li><li><a href="module-net_packets-AuthProposePacket.html">AuthProposePacket</a></li><li><a href="module-net_packets-AuthReplyPacket.html">AuthReplyPacket</a></li><li><a href="module-net_packets-BlockPacket.html">BlockPacket</a></li><li><a href="module-net_packets-BlockTxnPacket.html">BlockTxnPacket</a></li><li><a href="module-net_packets-CmpctBlockPacket.html">CmpctBlockPacket</a></li><li><a href="module-net_packets-EncackPacket.html">EncackPacket</a></li><li><a href="module-net_packets-EncinitPacket.html">EncinitPacket</a></li><li><a href="module-net_packets-FeeFilterPacket.html">FeeFilterPacket</a></li><li><a href="module-net_packets-FilterAddPacket.html">FilterAddPacket</a></li><li><a href="module-net_packets-FilterClearPacket.html">FilterClearPacket</a></li><li><a href="module-net_packets-FilterLoadPacket.html">FilterLoadPacket</a></li><li><a href="module-net_packets-GetAddrPacket.html">GetAddrPacket</a></li><li><a href="module-net_packets-GetBlocksPacket.html">GetBlocksPacket</a></li><li><a href="module-net_packets-GetBlockTxnPacket.html">GetBlockTxnPacket</a></li><li><a href="module-net_packets-GetDataPacket.html">GetDataPacket</a></li><li><a href="module-net_packets-GetHeadersPacket.html">GetHeadersPacket</a></li><li><a href="module-net_packets-HeadersPacket.html">HeadersPacket</a></li><li><a href="module-net_packets-InvPacket.html">InvPacket</a></li><li><a href="module-net_packets-MempoolPacket.html">MempoolPacket</a></li><li><a href="module-net_packets-MerkleBlockPacket.html">MerkleBlockPacket</a></li><li><a href="module-net_packets-NotFoundPacket.html">NotFoundPacket</a></li><li><a href="module-net_packets-Packet.html">Packet</a></li><li><a href="module-net_packets-PingPacket.html">PingPacket</a></li><li><a href="module-net_packets-PongPacket.html">PongPacket</a></li><li><a href="module-net_packets-RejectPacket.html">RejectPacket</a></li><li><a href="module-net_packets-SendCmpctPacket.html">SendCmpctPacket</a></li><li><a href="module-net_packets-SendHeadersPacket.html">SendHeadersPacket</a></li><li><a href="module-net_packets-TXPacket.html">TXPacket</a></li><li><a href="module-net_packets-UnknownPacket.html">UnknownPacket</a></li><li><a href="module-net_packets-VerackPacket.html">VerackPacket</a></li><li><a href="module-net_packets-VersionPacket.html">VersionPacket</a></li><li><a href="module-net_socks-Proxy.html">Proxy</a></li><li><a href="module-net_socks-SOCKS.html">SOCKS</a></li><li><a href="module-node.FullNode.html">FullNode</a></li><li><a href="module-node.Logger.html">Logger</a></li><li><a href="module-node.Node.html">Node</a></li><li><a href="module-node.NodeClient.html">NodeClient</a></li><li><a href="module-node.SPVNode.html">SPVNode</a></li><li><a href="module-primitives.AbstractBlock.html">AbstractBlock</a></li><li><a href="module-primitives.Address.html">Address</a></li><li><a href="module-primitives.Block.html">Block</a></li><li><a href="module-primitives.Coin.html">Coin</a></li><li><a href="module-primitives.CoinSelector.html">CoinSelector</a></li><li><a href="module-primitives.Headers.html">Headers</a></li><li><a href="module-primitives.Input.html">Input</a></li><li><a href="module-primitives.InvItem.html">InvItem</a></li><li><a href="module-primitives.KeyRing.html">KeyRing</a></li><li><a href="module-primitives.MemBlock.html">MemBlock</a></li><li><a href="module-primitives.MerkleBlock.html">MerkleBlock</a></li><li><a href="module-primitives.MTX.html">MTX</a></li><li><a href="module-primitives.NetAddress.html">NetAddress</a></li><li><a href="module-primitives.Outpoint.html">Outpoint</a></li><li><a href="module-primitives.Output.html">Output</a></li><li><a href="module-primitives.TX.html">TX</a></li><li><a href="module-primitives.TXMeta.html">TXMeta</a></li><li><a href="module-protocol.Network.html">Network</a></li><li><a href="module-protocol.TimeData.html">TimeData</a></li><li><a href="module-protocol_errors-VerifyError.html">VerifyError</a></li><li><a href="module-protocol_errors-VerifyResult.html">VerifyResult</a></li><li><a href="module-script.Opcode.html">Opcode</a></li><li><a href="module-script.Program.html">Program</a></li><li><a href="module-script.Script.html">Script</a></li><li><a href="module-script.ScriptError.html">ScriptError</a></li><li><a href="module-script.SigCache.html">SigCache</a></li><li><a href="module-script.Stack.html">Stack</a></li><li><a href="module-script.Witness.html">Witness</a></li><li><a href="module-utils.AsyncEmitter.html">AsyncEmitter</a></li><li><a href="module-utils.AsyncObject.html">AsyncObject</a></li><li><a href="module-utils.Bloom.html">Bloom</a></li><li><a href="module-utils.BufferReader.html">BufferReader</a></li><li><a href="module-utils.BufferWriter.html">BufferWriter</a></li><li><a href="module-utils.List.html">List</a></li><li><a href="module-utils.ListItem.html">ListItem</a></li><li><a href="module-utils.Lock.html">Lock</a></li><li><a href="module-utils.LRU.html">LRU</a></li><li><a href="module-utils.LRUBatch.html">LRUBatch</a></li><li><a href="module-utils.LRUItem.html">LRUItem</a></li><li><a href="module-utils.LRUOp.html">LRUOp</a></li><li><a href="module-utils.Map.html">Map</a></li><li><a href="module-utils.MappedLock.html">MappedLock</a></li><li><a href="module-utils.RollingFilter.html">RollingFilter</a></li><li><a href="module-utils.StaticWriter.html">StaticWriter</a></li><li><a href="module-utils_ip.Address.html">Address</a></li><li><a href="module-utils_protobuf-ProtoReader.html">ProtoReader</a></li><li><a href="module-utils_protobuf-ProtoWriter.html">ProtoWriter</a></li><li><a href="module-wallet.Account.html">Account</a></li><li><a href="module-wallet.Balance.html">Balance</a></li><li><a href="module-wallet.BlockRecord.html">BlockRecord</a></li><li><a href="module-wallet.ChainState.html">ChainState</a></li><li><a href="module-wallet.Credit.html">Credit</a></li><li><a href="module-wallet.Details.html">Details</a></li><li><a href="module-wallet.DetailsMember.html">DetailsMember</a></li><li><a href="module-wallet.MasterKey.html">MasterKey</a></li><li><a href="module-wallet.Path.html">Path</a></li><li><a href="module-wallet.TXDB.html">TXDB</a></li><li><a href="module-wallet.Wallet.html">Wallet</a></li><li><a href="module-wallet.WalletClient.html">WalletClient</a></li><li><a href="module-wallet.WalletDB.html">WalletDB</a></li><li><a href="module-wallet.WalletKey.html">WalletKey</a></li><li><a href="module-wallet.WalletOptions.html">WalletOptions</a></li><li><a href="module-wallet_records-BlockMapRecord.html">BlockMapRecord</a></li><li><a href="module-wallet_records-BlockMeta.html">BlockMeta</a></li><li><a href="module-wallet_records-ChainState.html">ChainState</a></li><li><a href="module-wallet_records-OutpointMapRecord.html">OutpointMapRecord</a></li><li><a href="module-wallet_records-PathMapRecord.html">PathMapRecord</a></li><li><a href="module-wallet_records-TXMapRecord.html">TXMapRecord</a></li><li><a href="module-wallet_records-TXRecord.html">TXRecord</a></li><li><a href="module-workers.Framer.html">Framer</a></li><li><a href="module-workers.Master.html">Master</a></li><li><a href="module-workers.Parser.html">Parser</a></li><li><a href="module-workers.ParserClient.html">ParserClient</a></li><li><a href="module-workers.Worker.html">Worker</a></li><li><a href="module-workers.WorkerPool.html">WorkerPool</a></li><li><a href="module-workers_packets-ECSignPacket.html">ECSignPacket</a></li><li><a href="module-workers_packets-ECSignResultPacket.html">ECSignResultPacket</a></li><li><a href="module-workers_packets-ECVerifyPacket.html">ECVerifyPacket</a></li><li><a href="module-workers_packets-ECVerifyResultPacket.html">ECVerifyResultPacket</a></li><li><a href="module-workers_packets-ErrorPacket.html">ErrorPacket</a></li><li><a href="module-workers_packets-ErrorResultPacket.html">ErrorResultPacket</a></li><li><a href="module-workers_packets-EventPacket.html">EventPacket</a></li><li><a href="module-workers_packets-LogPacket.html">LogPacket</a></li><li><a href="module-workers_packets-MinePacket.html">MinePacket</a></li><li><a href="module-workers_packets-MineResultPacket.html">MineResultPacket</a></li><li><a href="module-workers_packets-Packet.html">Packet</a></li><li><a href="module-workers_packets-ScryptPacket.html">ScryptPacket</a></li><li><a href="module-workers_packets-ScryptResultPacket.html">ScryptResultPacket</a></li><li><a href="module-workers_packets-SignInputPacket.html">SignInputPacket</a></li><li><a href="module-workers_packets-SignInputResultPacket.html">SignInputResultPacket</a></li><li><a href="module-workers_packets-SignPacket.html">SignPacket</a></li><li><a href="module-workers_packets-SignResultPacket.html">SignResultPacket</a></li><li><a href="module-workers_packets-VerifyInputPacket.html">VerifyInputPacket</a></li><li><a href="module-workers_packets-VerifyInputResultPacket.html">VerifyInputResultPacket</a></li><li><a href="module-workers_packets-VerifyPacket.html">VerifyPacket</a></li><li><a href="module-workers_packets-VerifyResultPacket.html">VerifyResultPacket</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-crypto_pk.ecdsa.html">ecdsa</a></li><li><a href="module-crypto_pk.rsa.html">rsa</a></li></ul><h3>Global</h3><ul><li><a href="global.html"></a></li><li><a href="global.html#DoubleMap">DoubleMap</a></li><li><a href="global.html#StatEntry">StatEntry</a></li></ul>
|
|
</nav>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Fri Feb 10 2017 09:40:23 GMT-0800 (PST)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|
|
|