On 12/10/2007, cwang <[EMAIL PROTECTED]> wrote:
>
> when my browser sent a header with "Accept-Encoding: gzip, deflate" it
> doesn't seem to be picked up by jmeter.  It was kind of weird cause it
> wasn't even in the input stream.
>
> then when I get the response there was a piece of code in Jmeter that
> removed "Content-Encoding: gzip"
> in proxy.java
>
>        /**
>         * In the event the content was gzipped and unpacked, the 
> content-encoding
>         * header must be removed and the content-length header should be
> corrected.
>         *
>         * @param res
>         * @param headers
>         * @return
>         */
>        private String massageResponseHeaders(SampleResult res, String 
> headers) {
>                int encodingHeaderLoc = headers.indexOf(": gzip"); // 
> $NON-NLS-1$
>                String newHeaders = headers;
>                if (encodingHeaderLoc > -1) {
>                        int end = headers.indexOf(NEW_LINE, encodingHeaderLoc);
>                        int begin = headers.lastIndexOf(NEW_LINE, 
> encodingHeaderLoc);
>                        newHeaders = newHeaders.substring(0, begin) + 
> newHeaders.substring(end);
>                        int lengthIndex = newHeaders.indexOf("ength: "); // 
> $NON-NLS-1$
>                        end = newHeaders.indexOf(NEW_LINE, lengthIndex);
>                        newHeaders = newHeaders.substring(0, lengthIndex + 7) +
> res.getResponseData().length
>                                        + newHeaders.substring(end);
>                }
>                return newHeaders;
>        }
>
> I don't know why this piece of code was added but it cause my browser,
> Internet Explorer 7, to return with a page cannot be displayed error.

I think that's because the JMeter Proxy uses a sampler to get the
response, and the sampler will already have unzipped the data.

> by hard coding "Accept-Encoding: gzip, deflate" into all my request header
> and returning the original "headers" from massageResponseHeaders it seems to
> work for my case.

What response header do you get?

> I was wondering if these changes would cause error or corrupt data in other
> areas of JMeter.

Probably.

> Thanks
> --
> View this message in context: 
> http://www.nabble.com/a-few-problems-I-encountered-gzip-and-header-tf4614182.html#a13177025
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to