Hi guys,

If the backend returns chunked gzip data it currently results in an error response from varnish. This is because both vfp_testgzip_bytes() and vfp_gunzip_bytes() assume that the gzipped stream ends at the end of the block being read. This obviously is not happening in case of chunked gzip, because chunking is done after gzipping.

I solved the problem by adding Z_OK to the condition (patch attached).


Best regards,

--
Dmitry Panov

diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 7af71c8..9b5180c 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -428,7 +428,7 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, 
ssize_t bytes)
                assert(i == Z_OK || i == Z_STREAM_END);
                sp->obj->len += dl;
        }
-       if (i == Z_STREAM_END)
+       if (i == Z_OK || i == Z_STREAM_END)
                return (1);
        return (-1);
 }
@@ -580,7 +580,7 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, 
ssize_t bytes)
                        assert(i == Z_OK || i == Z_STREAM_END);
                }
        }
-       if (i == Z_STREAM_END)
+       if (i == Z_OK || i == Z_STREAM_END)
                return (1);
        return (-1);
 }
_______________________________________________
varnish-dev mailing list
[email protected]
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to