index.js
function hostnameof (req) {
  var host = req.headers.host

  if (!host) {
    return
  }

  var offset = host[0] === '['
    ? host.indexOf(']') + 1
    : 0
  var index = host.indexOf(':', offset)

  return index !== -1
    ? host.substring(0, index)
    : host
}
function hostnameof (req) {
  var host = req.headers.host

  if (!host) {
    return
  }

  var offset = host[0] === '['
    ? host.indexOf(']') + 1
    : 0
  var index = host.indexOf(':', offset)

  return index !== -1
    ? host.substring(0, index)
    : host
}
function hostnameof ( req ) { var host = req . headers . host if ( ! host ) { return } var offset = host [ 0 ] === '[' ? host . indexOf ( ']' ) + 1 : 0 var index = host . indexOf ( ':' , offset ) return index !== - 1 ? host . substring ( 0 , index ) : host }
Get hostname of request.

@param (object} req
@return {string}
@private
Get hostname of request .