Commit f8df3378 by Jean-Eric Cuendet Committed by Dave Syer

Verify that the stream is more than ZERO bytes before un-gzipping

Fixes gh-891
parent 3c8a0d0e
......@@ -125,6 +125,10 @@ public class SendResponseFilter extends ZuulFilter {
// before sending to client
// else, stream gzip directly to client
if (context.getResponseGZipped() && !isGzipRequested) {
// If origin tell it's GZipped but the content is ZERO bytes,
// don't try to uncompress
final Long len = context.getOriginContentLength();
if (len == null || len > 0) {
try {
inputStream = new GZIPInputStream(is);
}
......@@ -138,6 +142,10 @@ public class SendResponseFilter extends ZuulFilter {
inputStream = is;
}
}
else {
// Already done : inputStream = is;
}
}
else if (context.getResponseGZipped() && isGzipRequested) {
servletResponse.setHeader(ZuulHeaders.CONTENT_ENCODING, "gzip");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment