Find a connection that matches this kojiweb URL.

        Check all koji.conf.d files' kojiweb URLs and load the profile that
        matches the url we pass in here.

        For example, if a user pastes a kojiweb URL into chat, we want to
        discover the corresponding Koji instance hub automatically.

        See also from_web().

        :param url: ``str``, for example
                    "http://cbs.centos.org/koji/buildinfo?buildID=21155"
        :returns: A "Connection" instance

def connect_from_web(klass, url):
        """
        Find a connection that matches this kojiweb URL.

        Check all koji.conf.d files' kojiweb URLs and load the profile that
        matches the url we pass in here.

        For example, if a user pastes a kojiweb URL into chat, we want to
        discover the corresponding Koji instance hub automatically.

        See also from_web().

        :param url: ``str``, for example
                    "http://cbs.centos.org/koji/buildinfo?buildID=21155"
        :returns: A "Connection" instance
        """
        # Treat any input with whitespace as invalid:
        if re.search(r'\s', url):
            return
        url = url.split(' ', 1)[0]
        for path in profiles():
            cfg = SafeConfigParser()
            cfg.read(path)
            for profile in cfg.sections():
                if not cfg.has_option(profile, 'weburl'):
                    continue
                weburl = cfg.get(profile, 'weburl')
                if url.startswith(weburl):
                    return klass(profile)