'Return the base (scheme://host[:port] or sock file) for this server.'

def base(self):

    if self.socket_file:
        return self.socket_file
    host = self.socket_host
    if (host in ('0.0.0.0', '::')):
        import socket
        host = socket.gethostname()
    port = self.socket_port
    if self.ssl_certificate:
        scheme = 'https'
        if (port != 443):
            host += (':%s' % port)
    else:
        scheme = 'http'
        if (port != 80):
            host += (':%s' % port)
    return ('%s://%s' % (scheme, host))
