示例#1
0
                headers = _[0]

            elif _[1]:  # is not an empty string
                connect = _[0]
                headers = _[1]
                request = Request(connect.split('\n')[0] + '\n').parse()

                if not request:
                    return message, 'file', 'internal_error.html', ''
                h = HTTP(self.configuration, headers, message.client)
                if not h.parse(self._transparent) or h.reply_code:
                    return message, 'file', 'internal_error.html', ''

                # The trick to not have to extend ICAP
                h.host = request.host
                h.port = request.port
                return h, 'permit', None, comment

        # Parsing the request from the ICAP server
        h = HTTP(self.configuration, headers, message.client)
        if not h.parse(self._transparent) or h.reply_code:
            return message, 'file', 'internal_error.html', comment

        return h, 'permit', None, comment

    def _classify_url(self, message, headers, tainted):
        if not self.process:
            self.log.error('No more process to evaluate message')
            return message, 'file', 'internal_error.html', ''

        try:
示例#2
0
		if headers.startswith('CONNECT'):
			_ = headers.replace('\r\n','\n').split('\n\n',1)
			if _[1]:  # is not an empty string
				connect = _[0]
				headers = _[1]
				request = Request(connect.split('\n')[0]).parse()

				if not request:
					return message, 'file', 'internal_error.html', ''
				h = HTTP(self.configuration,headers,message.client)
				if not h.parse(self._transparent) or h.reply_code:
					return message, 'file', 'internal_error.html', ''

				# The trick to not have to extend ICAP
				h.host = request.host
				h.port = request.port
				return h,'permit',None,comment

		# Parsing the request from the ICAP server
		h = HTTP(self.configuration,headers,message.client)
		if not h.parse(self._transparent) or h.reply_code:
			return message, 'file', 'internal_error.html', comment

		return h, 'permit', None, comment

	def _classify_url (self, message, headers, tainted):
		if not self.process:
			self.log.error('No more process to evaluate message')
			return message, 'file', 'internal_error.html', ''

		try: