diff --git a/plugins/transformation_gzip/gzip.c b/plugins/transformation_gzip/gzip.c index 645c7736..6ba5844d 100644 --- a/plugins/transformation_gzip/gzip.c +++ b/plugins/transformation_gzip/gzip.c @@ -23,6 +23,11 @@ static int transform_gzip(struct wsgi_request *wsgi_req, struct uwsgi_transforma struct uwsgi_transformation_gzip *utgz = (struct uwsgi_transformation_gzip *) ut->data; struct uwsgi_buffer *ub = ut->chunk; + if (ub->pos == 0) { + // Don't try to compress empty responses. + return 0; + } + if (ut->is_final) { if (uwsgi_gzip_fix(&utgz->z, utgz->crc32, ub, utgz->len)) { free(utgz);