'Get the hostname that the user passed in to the request.
This will either use the Host: header (if it is available) or the
host we are listening on if the header is unavailable.
@returns: the requested hostname
@rtype: C{bytes}'

def getRequestHostname(self):

    host = self.getHeader('host')
    if host:
        return host.split(':', 1)[0]
    return networkString(self.getHost().host)
