'Return the current server host, e.g. \'localhost\''

def http_host(self):

    try:
        return self.headers.get('host', 'localhost').rsplit(':', 1)[0]
    except AttributeError:
        return 'unknown'
