def _isAllowed()

in plugins/passthrough/pt/PassThroughWriter.py [0:0]


    def _isAllowed(self, url):
        allow = self._configuration.get('service', 'allow')
        allows = allow.split(',')
        for i in range(len(allows)):
            allows[i] = allows[i].strip()

        """
        for value in allows:
            logging.debug('allow: '+value)
        """

        segments = urllib.parse.urlparse(url)
        netlocation = segments.netloc

        targets = [netlocation]
        netlocations = netlocation.split(':')
        if len(netlocations) == 2:
            if netlocations[1] == '80':
                targets.append(netlocations[0])

        """
        for element in targets:
            logging.debug('target: '+element)
        """

        isAllowed = False
        for target in targets:
            for element in allows:
                if target == element:
                    isAllowed = True
                    break

        return isAllowed