Пример #1
0
    def set_body(self, content):
        if content is None:
            return

        if self.get_header('Content-Encoding') == 'gzip':
            content = gzip(content)

        self.body = content
        self.len_body = len(self.body)
        self.set_header('Content-Length', self.len_body)
Пример #2
0
	def set_body(self, content):
		if content is None:
			return

		if self.get_header('Content-Encoding') == 'gzip':
			content = gzip(content)

		self.body = content
		self.len_body = len(self.body)
		self.set_header('Content-Length', self.len_body)
Пример #3
0
    def process(self):

        # in any case of redirection with HTTP protocol use
        if self.http.is_redirection():
            location = self.http.get_header("Location")
            if location is not None and location.startswith("http://"):
                location = location.replace("http", "https", 1)
                self.http.set_header("Location", location)

        # XML rewriting on start.php request
        if self.communicator.http.path == "/ovd/client/start.php" and not self.communicator.http.xml_rewrited:
            is_zipped = (self.http.get_header('Content-Encoding') == 'gzip')
            if is_zipped:
                self.http.body = gunzip(self.http.body)

            xml = self.rewrite_xml()
            if xml is not None:
                if is_zipped:
                    xml = gzip(xml)
                self.http.set_body(xml)
                self.http.xml_rewrited = True

        return self.http.show()
Пример #4
0
	def process(self):
		
		# in any case of redirection with HTTP protocol use
		if self.http.is_redirection():
			location = self.http.get_header("Location")
			if location is not None and location.startswith("http://"):
				location = location.replace("http", "https", 1)
				self.http.set_header("Location", location)
		
		# XML rewriting on start.php request
		if self.communicator.http.path == "/ovd/client/start.php" and not self.communicator.http.xml_rewrited:
			is_zipped = (self.http.get_header('Content-Encoding') == 'gzip')
			if is_zipped:
				self.http.body = gunzip(self.http.body)
			
			xml = self.rewrite_xml()
			if xml is not None:
				if is_zipped:
					xml = gzip(xml)
				self.http.set_body(xml)
				self.http.xml_rewrited = True
		
		return self.http.show()