Esempio n. 1
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()
Esempio n. 2
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()
Esempio n. 3
0
	def get_body(self):
		if self.get_header('Content-Encoding') == 'gzip':
			return gunzip(self.body)
		else:
			return self.body
Esempio n. 4
0
 def get_body(self):
     if self.get_header('Content-Encoding') == 'gzip':
         return gunzip(self.body)
     else:
         return self.body