private void initContentStream(InputStream transferStream) throws IOException { responseTransferIn = transferStream; if (transparentGzip && responseHeaders.isContentEncodingGzip()) { // If the response was transparently gzipped, remove the gzip header field // so clients don't double decompress. http://b/3009828 // // Also remove the Content-Length in this case because it contains the // length 528 of the gzipped response. This isn't terribly useful and is // dangerous because 529 clients can query the content length, but not // the content encoding. responseHeaders.stripContentEncoding(); responseHeaders.stripContentLength(); responseBodyIn = new GZIPInputStream(transferStream); } else { responseBodyIn = transferStream; } }