/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['utils.js']) {
  _$jscoverage['utils.js'] = [];
  _$jscoverage['utils.js'][13] = 0;
  _$jscoverage['utils.js'][26] = 0;
  _$jscoverage['utils.js'][27] = 0;
  _$jscoverage['utils.js'][39] = 0;
  _$jscoverage['utils.js'][40] = 0;
  _$jscoverage['utils.js'][41] = 0;
  _$jscoverage['utils.js'][54] = 0;
  _$jscoverage['utils.js'][55] = 0;
  _$jscoverage['utils.js'][56] = 0;
  _$jscoverage['utils.js'][57] = 0;
  _$jscoverage['utils.js'][73] = 0;
  _$jscoverage['utils.js'][74] = 0;
  _$jscoverage['utils.js'][95] = 0;
  _$jscoverage['utils.js'][96] = 0;
  _$jscoverage['utils.js'][97] = 0;
  _$jscoverage['utils.js'][98] = 0;
  _$jscoverage['utils.js'][101] = 0;
  _$jscoverage['utils.js'][112] = 0;
  _$jscoverage['utils.js'][113] = 0;
  _$jscoverage['utils.js'][132] = 0;
  _$jscoverage['utils.js'][133] = 0;
  _$jscoverage['utils.js'][147] = 0;
  _$jscoverage['utils.js'][148] = 0;
  _$jscoverage['utils.js'][149] = 0;
  _$jscoverage['utils.js'][166] = 0;
  _$jscoverage['utils.js'][167] = 0;
  _$jscoverage['utils.js'][168] = 0;
  _$jscoverage['utils.js'][169] = 0;
  _$jscoverage['utils.js'][184] = 0;
  _$jscoverage['utils.js'][185] = 0;
  _$jscoverage['utils.js'][186] = 0;
  _$jscoverage['utils.js'][187] = 0;
  _$jscoverage['utils.js'][188] = 0;
  _$jscoverage['utils.js'][189] = 0;
  _$jscoverage['utils.js'][190] = 0;
  _$jscoverage['utils.js'][191] = 0;
  _$jscoverage['utils.js'][192] = 0;
  _$jscoverage['utils.js'][196] = 0;
  _$jscoverage['utils.js'][208] = 0;
  _$jscoverage['utils.js'][209] = 0;
  _$jscoverage['utils.js'][222] = 0;
  _$jscoverage['utils.js'][223] = 0;
  _$jscoverage['utils.js'][224] = 0;
  _$jscoverage['utils.js'][225] = 0;
  _$jscoverage['utils.js'][226] = 0;
  _$jscoverage['utils.js'][228] = 0;
  _$jscoverage['utils.js'][239] = 0;
  _$jscoverage['utils.js'][240] = 0;
  _$jscoverage['utils.js'][241] = 0;
  _$jscoverage['utils.js'][242] = 0;
  _$jscoverage['utils.js'][267] = 0;
  _$jscoverage['utils.js'][276] = 0;
  _$jscoverage['utils.js'][277] = 0;
  _$jscoverage['utils.js'][278] = 0;
  _$jscoverage['utils.js'][279] = 0;
  _$jscoverage['utils.js'][292] = 0;
  _$jscoverage['utils.js'][293] = 0;
  _$jscoverage['utils.js'][305] = 0;
  _$jscoverage['utils.js'][306] = 0;
  _$jscoverage['utils.js'][307] = 0;
  _$jscoverage['utils.js'][308] = 0;
  _$jscoverage['utils.js'][319] = 0;
  _$jscoverage['utils.js'][320] = 0;
  _$jscoverage['utils.js'][321] = 0;
  _$jscoverage['utils.js'][322] = 0;
  _$jscoverage['utils.js'][334] = 0;
  _$jscoverage['utils.js'][335] = 0;
  _$jscoverage['utils.js'][346] = 0;
  _$jscoverage['utils.js'][347] = 0;
  _$jscoverage['utils.js'][350] = 0;
  _$jscoverage['utils.js'][351] = 0;
  _$jscoverage['utils.js'][355] = 0;
  _$jscoverage['utils.js'][358] = 0;
  _$jscoverage['utils.js'][369] = 0;
  _$jscoverage['utils.js'][370] = 0;
  _$jscoverage['utils.js'][371] = 0;
  _$jscoverage['utils.js'][372] = 0;
  _$jscoverage['utils.js'][374] = 0;
  _$jscoverage['utils.js'][386] = 0;
}
_$jscoverage['utils.js'][13]++;
var http = require("http"), crypto = require("crypto"), parse = require("url").parse, signature = require("cookie-signature");
_$jscoverage['utils.js'][26]++;
exports.hasBody = (function (req) {
  _$jscoverage['utils.js'][27]++;
  return "transfer-encoding" in req.headers || "content-length" in req.headers;
});
_$jscoverage['utils.js'][39]++;
exports.mime = (function (req) {
  _$jscoverage['utils.js'][40]++;
  var str = req.headers["content-type"] || "";
  _$jscoverage['utils.js'][41]++;
  return str.split(";")[0];
});
_$jscoverage['utils.js'][54]++;
exports.error = (function (code, msg) {
  _$jscoverage['utils.js'][55]++;
  var err = new Error(msg || http.STATUS_CODES[code]);
  _$jscoverage['utils.js'][56]++;
  err.status = code;
  _$jscoverage['utils.js'][57]++;
  return err;
});
_$jscoverage['utils.js'][73]++;
exports.md5 = (function (str, encoding) {
  _$jscoverage['utils.js'][74]++;
  return crypto.createHash("md5").update(str).digest(encoding || "hex");
});
_$jscoverage['utils.js'][95]++;
exports.merge = (function (a, b) {
  _$jscoverage['utils.js'][96]++;
  if (a && b) {
    _$jscoverage['utils.js'][97]++;
    for (var key in b) {
      _$jscoverage['utils.js'][98]++;
      a[key] = b[key];
}
  }
  _$jscoverage['utils.js'][101]++;
  return a;
});
_$jscoverage['utils.js'][112]++;
exports.escape = (function (html) {
  _$jscoverage['utils.js'][113]++;
  return String(html).replace(/&(?!\w+;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
});
_$jscoverage['utils.js'][132]++;
exports.uid = (function (len) {
  _$jscoverage['utils.js'][133]++;
  return crypto.randomBytes(Math.ceil(len * 3 / 4)).toString("base64").slice(0, len);
});
_$jscoverage['utils.js'][147]++;
exports.sign = (function (val, secret) {
  _$jscoverage['utils.js'][148]++;
  console.warn("do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature");
  _$jscoverage['utils.js'][149]++;
  return val + "." + crypto.createHmac("sha256", secret).update(val).digest("base64").replace(/=+$/, "");
});
_$jscoverage['utils.js'][166]++;
exports.unsign = (function (val, secret) {
  _$jscoverage['utils.js'][167]++;
  console.warn("do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature");
  _$jscoverage['utils.js'][168]++;
  var str = val.slice(0, val.lastIndexOf("."));
  _$jscoverage['utils.js'][169]++;
  return exports.sign(str, secret) == val? str: false;
});
_$jscoverage['utils.js'][184]++;
exports.parseSignedCookies = (function (obj, secret) {
  _$jscoverage['utils.js'][185]++;
  var ret = {};
  _$jscoverage['utils.js'][186]++;
  Object.keys(obj).forEach((function (key) {
  _$jscoverage['utils.js'][187]++;
  var val = obj[key];
  _$jscoverage['utils.js'][188]++;
  if (0 == val.indexOf("s:")) {
    _$jscoverage['utils.js'][189]++;
    val = signature.unsign(val.slice(2), secret);
    _$jscoverage['utils.js'][190]++;
    if (val) {
      _$jscoverage['utils.js'][191]++;
      ret[key] = val;
      _$jscoverage['utils.js'][192]++;
      delete obj[key];
    }
  }
}));
  _$jscoverage['utils.js'][196]++;
  return ret;
});
_$jscoverage['utils.js'][208]++;
exports.parseSignedCookie = (function (str, secret) {
  _$jscoverage['utils.js'][209]++;
  return 0 == str.indexOf("s:")? signature.unsign(str.slice(2), secret): str;
});
_$jscoverage['utils.js'][222]++;
exports.parseJSONCookies = (function (obj) {
  _$jscoverage['utils.js'][223]++;
  Object.keys(obj).forEach((function (key) {
  _$jscoverage['utils.js'][224]++;
  var val = obj[key];
  _$jscoverage['utils.js'][225]++;
  var res = exports.parseJSONCookie(val);
  _$jscoverage['utils.js'][226]++;
  if (res) {
    _$jscoverage['utils.js'][226]++;
    obj[key] = res;
  }
}));
  _$jscoverage['utils.js'][228]++;
  return obj;
});
_$jscoverage['utils.js'][239]++;
exports.parseJSONCookie = (function (str) {
  _$jscoverage['utils.js'][240]++;
  if (0 == str.indexOf("j:")) {
    _$jscoverage['utils.js'][241]++;
    try {
      _$jscoverage['utils.js'][242]++;
      return JSON.parse(str.slice(2));
    }
    catch (err) {
    }
  }
});
_$jscoverage['utils.js'][267]++;
exports.pause = require("pause");
_$jscoverage['utils.js'][276]++;
exports.removeContentHeaders = (function (res) {
  _$jscoverage['utils.js'][277]++;
  Object.keys(res._headers).forEach((function (field) {
  _$jscoverage['utils.js'][278]++;
  if (0 == field.indexOf("content")) {
    _$jscoverage['utils.js'][279]++;
    res.removeHeader(field);
  }
}));
});
_$jscoverage['utils.js'][292]++;
exports.conditionalGET = (function (req) {
  _$jscoverage['utils.js'][293]++;
  return req.headers["if-modified-since"] || req.headers["if-none-match"];
});
_$jscoverage['utils.js'][305]++;
exports.unauthorized = (function (res, realm) {
  _$jscoverage['utils.js'][306]++;
  res.statusCode = 401;
  _$jscoverage['utils.js'][307]++;
  res.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\"");
  _$jscoverage['utils.js'][308]++;
  res.end("Unauthorized");
});
_$jscoverage['utils.js'][319]++;
exports.notModified = (function (res) {
  _$jscoverage['utils.js'][320]++;
  exports.removeContentHeaders(res);
  _$jscoverage['utils.js'][321]++;
  res.statusCode = 304;
  _$jscoverage['utils.js'][322]++;
  res.end();
});
_$jscoverage['utils.js'][334]++;
exports.etag = (function (stat) {
  _$jscoverage['utils.js'][335]++;
  return "\"" + stat.size + "-" + Number(stat.mtime) + "\"";
});
_$jscoverage['utils.js'][346]++;
exports.parseCacheControl = (function (str) {
  _$jscoverage['utils.js'][347]++;
  var directives = str.split(","), obj = {};
  _$jscoverage['utils.js'][350]++;
  for (var i = 0, len = directives.length; i < len; i++) {
    _$jscoverage['utils.js'][351]++;
    var parts = directives[i].split("="), key = parts.shift().trim(), val = parseInt(parts.shift(), 10);
    _$jscoverage['utils.js'][355]++;
    obj[key] = isNaN(val)? true: val;
}
  _$jscoverage['utils.js'][358]++;
  return obj;
});
_$jscoverage['utils.js'][369]++;
exports.parseUrl = (function (req) {
  _$jscoverage['utils.js'][370]++;
  var parsed = req._parsedUrl;
  _$jscoverage['utils.js'][371]++;
  if (parsed && parsed.href == req.url) {
    _$jscoverage['utils.js'][372]++;
    return parsed;
  }
  else {
    _$jscoverage['utils.js'][374]++;
    return req._parsedUrl = parse(req.url);
  }
});
_$jscoverage['utils.js'][386]++;
exports.parseBytes = require("bytes");
_$jscoverage['utils.js'].source = ["","/*!"," * Connect - utils"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')","  , crypto = require('crypto')","  , parse = require('url').parse","  , signature = require('cookie-signature');","","/**"," * Return `true` if the request has a body, otherwise return `false`."," *"," * @param  {IncomingMessage} req"," * @return {Boolean}"," * @api private"," */","","exports.hasBody = function(req) {","  return 'transfer-encoding' in req.headers || 'content-length' in req.headers;","};","","/**"," * Extract the mime type from the given request's"," * _Content-Type_ header."," *"," * @param  {IncomingMessage} req"," * @return {String}"," * @api private"," */","","exports.mime = function(req) {","  var str = req.headers['content-type'] || '';","  return str.split(';')[0];","};","","/**"," * Generate an `Error` from the given status `code`"," * and optional `msg`."," *"," * @param {Number} code"," * @param {String} msg"," * @return {Error}"," * @api private"," */","","exports.error = function(code, msg){","  var err = new Error(msg || http.STATUS_CODES[code]);","  err.status = code;","  return err;","};","","/**"," * Return md5 hash of the given string and optional encoding,"," * defaulting to hex."," *"," *     utils.md5('wahoo');"," *     // =&gt; \"e493298061761236c96b02ea6aa8a2ad\""," *"," * @param {String} str"," * @param {String} encoding"," * @return {String}"," * @api private"," */","","exports.md5 = function(str, encoding){","  return crypto","    .createHash('md5')","    .update(str)","    .digest(encoding || 'hex');","};","","/**"," * Merge object b with object a."," *"," *     var a = { foo: 'bar' }"," *       , b = { bar: 'baz' };"," *     "," *     utils.merge(a, b);"," *     // =&gt; { foo: 'bar', bar: 'baz' }"," *"," * @param {Object} a"," * @param {Object} b"," * @return {Object}"," * @api private"," */","","exports.merge = function(a, b){","  if (a &amp;&amp; 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(/&amp;(?!\\w+;)/g, '&amp;amp;')","    .replace(/&lt;/g, '&amp;lt;')","    .replace(/&gt;/g, '&amp;gt;')","    .replace(/\"/g, '&amp;quot;');","};","","","/**"," * Return a unique identifier with the given `len`."," *"," *     utils.uid(10);"," *     // =&gt; \"FDaS435D2z\""," *"," * @param {Number} len"," * @return {String}"," * @api private"," */","","exports.uid = function(len) {","  return crypto.randomBytes(Math.ceil(len * 3 / 4))","    .toString('base64')","    .slice(0, len);","};","","/**"," * Sign the given `val` with `secret`."," *"," * @param {String} val"," * @param {String} secret"," * @return {String}"," * @api private"," */","","exports.sign = function(val, secret){","  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."," *"," *      var pause = utils.pause(req);"," *      fs.readFile(path, function(){"," *         next();"," *         pause.resume();"," *      });"," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.pause = require('pause');","","/**"," * Strip `Content-*` headers from `res`."," *"," * @param {ServerResponse} res"," * @api private"," */","","exports.removeContentHeaders = function(res){","  Object.keys(res._headers).forEach(function(field){","    if (0 == field.indexOf('content')) {","      res.removeHeader(field);","    }","  });","};","","/**"," * Check if `req` is a conditional GET request."," *"," * @param {IncomingMessage} req"," * @return {Boolean}"," * @api private"," */","","exports.conditionalGET = function(req) {","  return req.headers['if-modified-since']","    || req.headers['if-none-match'];","};","","/**"," * Respond with 401 \"Unauthorized\"."," *"," * @param {ServerResponse} res"," * @param {String} realm"," * @api private"," */","","exports.unauthorized = function(res, realm) {","  res.statusCode = 401;","  res.setHeader('WWW-Authenticate', 'Basic realm=\"' + realm + '\"');","  res.end('Unauthorized');","};","","/**"," * Respond with 304 \"Not Modified\"."," *"," * @param {ServerResponse} res"," * @param {Object} headers"," * @api private"," */","","exports.notModified = function(res) {","  exports.removeContentHeaders(res);","  res.statusCode = 304;","  res.end();","};","","/**"," * Return an ETag in the form of `\"&lt;size&gt;-&lt;mtime&gt;\"`"," * 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 &lt; 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 &amp;&amp; parsed.href == req.url) {","    return parsed;","  } else {","    return req._parsedUrl = parse(req.url);","  }","};","","/**"," * Parse byte `size` string."," *"," * @param {String} size"," * @return {Number}"," * @api private"," */","","exports.parseBytes = require('bytes');"];
