'Find longest match for a given URL path.'

def _match(self, host, port, path_info):

    for ((domain, app_url), app) in self.applications:
        if (domain and (domain != host) and (domain != ((host + ':') + port))):
            continue
        if ((path_info == app_url) or path_info.startswith((app_url + '/'))):
            return (app, app_url)
    return (None, None)
