I use Bottle to receive gzipped request body. When the size of the request is small, everything is fine. However, if the size of request body is a bit larger (say, >= 20kb), an IOError is thrown.
The following is the code used to read and decompress the request body:
@post("/receive") def receive(): try: f = request.body g_f = gzip.GzipFile(fileobj=f) content = g_f.read() # other stuff on the content... except IOError, e: # handle the error
The error message is:
[2015-09-07 16:27:27,967][ERROR ] Failed to decompress gzipped data: [Errno 9] read() on write-only GzipFile object 127.0.0.1 - - [07/Sep/2015 16:27:27] "POST /receive HTTP/1.1" 400 756