Bug 58609 - JMeter support for gzip for requests when content-encoding is set to gzip
Summary: JMeter support for gzip for requests when content-encoding is set to gzip
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.13
Hardware: All All
: P1 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-13 19:49 UTC by jayakhanna.p
Modified: 2019-05-15 13:13 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jayakhanna.p 2015-11-13 19:49:58 UTC
While setting the content-encoding to gzip in the http header manager and trying to send the POST request, the http body content isn't compressed and eventually throws an error. 

Would be good to add support for gzip, deflate for the request too. Looked at the code and we do use GzipInputStream for the responses. 

http://svn.apache.org/repos/asf/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
<snip>
if (instream != null) {// will be null for HEAD
                instream = new CountingInputStream(instream);
                try {
                    Header responseHeader = httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
                    if (responseHeader!= null && HTTPConstants.ENCODING_GZIP.equals(responseHeader.getValue())) {
                        InputStream tmpInput = new GZIPInputStream(instream); // tmp inputstream needs to have a good counting
                        res.setResponseData(readResponse(res, tmpInput, (int) httpMethod.getResponseContentLength()));                        
                    } else {
                        res.setResponseData(readResponse(res, instream, (int) httpMethod.getResponseContentLength()));
                    }
                } finally {
                    JOrphanUtils.closeQuietly(instream);
                }
            }
<snip>