googleapis/storage-testbench

Review implementation of decompressive transcoding

coryan opened this issue · 0 comments

I am not sure the implementation of decompressive transcoding works as it should. It seems to decompress the data when uploaded:

def __call__(self, environ, start_response):
request = Request(environ)
if request.headers.get("Content-Encoding", "") == "gzip":
request.data = gzip.decompress(request.data)
request.environ["wsgi.input"] = io.BytesIO(request.data)
return self.app(environ, start_response)

But that probably won't work with uploadType=multipart, where the Content-Type is multipart/related;. I think we need to decompress the results on the fly, and disable decompression if the Accept-Encoding: gzip flag is enabled. We also need to store the checksums of the compressed data, which suggests (again) that decompressing the request is not the right idea.