/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['middleware/vhost.js']) {
  _$jscoverage['middleware/vhost.js'] = [];
  _$jscoverage['middleware/vhost.js'][28] = 0;
  _$jscoverage['middleware/vhost.js'][29] = 0;
  _$jscoverage['middleware/vhost.js'][30] = 0;
  _$jscoverage['middleware/vhost.js'][31] = 0;
  _$jscoverage['middleware/vhost.js'][32] = 0;
  _$jscoverage['middleware/vhost.js'][33] = 0;
  _$jscoverage['middleware/vhost.js'][34] = 0;
  _$jscoverage['middleware/vhost.js'][35] = 0;
  _$jscoverage['middleware/vhost.js'][36] = 0;
  _$jscoverage['middleware/vhost.js'][37] = 0;
  _$jscoverage['middleware/vhost.js'][38] = 0;
}
_$jscoverage['middleware/vhost.js'][28]++;
module.exports = (function vhost(hostname, server) {
  _$jscoverage['middleware/vhost.js'][29]++;
  if (! hostname) {
    _$jscoverage['middleware/vhost.js'][29]++;
    throw new Error("vhost hostname required");
  }
  _$jscoverage['middleware/vhost.js'][30]++;
  if (! server) {
    _$jscoverage['middleware/vhost.js'][30]++;
    throw new Error("vhost server required");
  }
  _$jscoverage['middleware/vhost.js'][31]++;
  var regexp = new RegExp("^" + hostname.replace(/[*]/g, "(.*?)") + "$", "i");
  _$jscoverage['middleware/vhost.js'][32]++;
  if (server.onvhost) {
    _$jscoverage['middleware/vhost.js'][32]++;
    server.onvhost(hostname);
  }
  _$jscoverage['middleware/vhost.js'][33]++;
  return (function vhost(req, res, next) {
  _$jscoverage['middleware/vhost.js'][34]++;
  if (! req.headers.host) {
    _$jscoverage['middleware/vhost.js'][34]++;
    return next();
  }
  _$jscoverage['middleware/vhost.js'][35]++;
  var host = req.headers.host.split(":")[0];
  _$jscoverage['middleware/vhost.js'][36]++;
  if (! regexp.test(host)) {
    _$jscoverage['middleware/vhost.js'][36]++;
    return next();
  }
  _$jscoverage['middleware/vhost.js'][37]++;
  if ("function" == typeof server) {
    _$jscoverage['middleware/vhost.js'][37]++;
    return server(req, res, next);
  }
  _$jscoverage['middleware/vhost.js'][38]++;
  server.emit("request", req, res);
});
});
_$jscoverage['middleware/vhost.js'].source = ["","/*!"," * Connect - vhost"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Vhost:"," * "," *   Setup vhost for the given `hostname` and `server`."," *"," *     connect()"," *       .use(connect.vhost('foo.com', fooApp))"," *       .use(connect.vhost('bar.com', barApp))"," *       .use(connect.vhost('*.com', mainApp))"," *"," *  The `server` may be a Connect server or"," *  a regular Node `http.Server`. "," *"," * @param {String} hostname"," * @param {Server} server"," * @return {Function}"," * @api public"," */","","module.exports = function vhost(hostname, server){","  if (!hostname) throw new Error('vhost hostname required');","  if (!server) throw new Error('vhost server required');","  var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i');","  if (server.onvhost) server.onvhost(hostname);","  return function vhost(req, res, next){","    if (!req.headers.host) return next();","    var host = req.headers.host.split(':')[0];","    if (!regexp.test(host)) return next();","    if ('function' == typeof server) return server(req, res, next);","    server.emit('request', req, res);","  };","};"];
