Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def decode_message (msg, iscompressed):
if iscompressed:
decompressor = compressors.GZipDecompressor ()
msg = decompressor.decompress (msg) + decompressor.flush ()
return msg
def init_buffer (self):
self.set_max_age ()
ct = self.get_header ("content-type", "")
if ct.startswith ('application/grpc'):
self.p, self.u = buffers.getfakeparser (grpc_buffer, cache = self.max_age)
elif ct.startswith ('text/xml') and self.request.xmlrpc_serialized ():
self.p = self.u = buffers.cachable_xmlrpc_buffer (self.max_age)
self.is_xmlrpc_return = True
elif ct.startswith ('application/json-rpc'):
self.p = self.u = buffers.cachable_jsonrpc_buffer (self.max_age)
else:
self.p, self.u = buffers.getfakeparser (buffers.bytes_buffer, cache = self.max_age)
if self.get_header ("Content-Encoding") == "gzip":
self.decompressor = compressors.GZipDecompressor ()