Don't try to compress empty responses.

This commit is contained in:
Curtis Maloney
2015-02-20 13:44:42 +11:00
parent b60d9822e6
commit 47a15480da
+5
View File
@@ -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);