You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2016/05/01 14:59:51 UTC

[Bug 59401] New: The HttpClient4 implementation haven't used compress when compress method included in Accept-Encoding[request header]

https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

            Bug ID: 59401
           Summary: The HttpClient4 implementation haven't used compress
                    when compress method included in
                    Accept-Encoding[request header]
           Product: JMeter
           Version: 3.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: HTTP
          Assignee: issues@jmeter.apache.org
          Reporter: liu.xp2003@gmail.com

Steps:
1. use latest JMeter night build[3.0 svn 1741803]
2. create a http sample[http://www.apache.org] with HTTP Header Manager config
element.
3. add "Accept-Encoding = gzip, deflate" into HTTP Header Manager.
4. use HttpClient4 implementation in HTTP Request Sampler.
5. Check the sampler result with View Results Tree.


Expect results:
The String "Content-Encoding: gzip" should be included Response headers.
The body size is less than the content size because it should be compressed.
The behavior is same as JMeter 2.13.


Current results:
There is no Content-Encoding parameter in response headers.
The body size is bigger than HttpClient3.1 implementation result.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #12 from Sebb <se...@apache.org> ---
Created attachment 33823
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33823&action=edit
Alternative patch using Context

This avoids the Set and lowercasing.

It also allows for the headers not being deleted: the HC code actually has
another check before uncompressing and removing them; also if the decompress
fails presumably HC won't drop the headers.

We should not store them twice.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #3 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Created attachment 33817
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33817&action=edit
Patch for issue

Hello,
Here's a first proposal for a fix:
- Register a ResponseInterceptor at first position that will backup the headers
in localContext as JMETER_RESPONSE_HEADERS attribute
- Use this backup when computing response headers in SampleResult

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #14 from Milamber <mi...@apache.org> ---

That(In reply to Philippe Mouawad from comment #13)
> (In reply to Sebb from comment #12)
> > Created attachment 33823 [details]
> > Alternative patch using Context
> > 
> > This avoids the Set and lowercasing.
> > 
> > It also allows for the headers not being deleted: the HC code actually has
> > another check before uncompressing and removing them; also if the decompress
> > fails presumably HC won't drop the headers.
> > 
> > We should not store them twice.
> 
> Ok for me

@Sebb @Philippe : That means we have a consensus with the last patch of Sebb?
If yes, Sebb can you commit on the trunk, please.
No blocker now to 3.0 RC4?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #15 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Authors: sebb & pmouawad
Date: Wed May  4 19:49:51 2016
New Revision: 1742324

URL: http://svn.apache.org/viewvc?rev=1742324&view=rev
Log:
Bug 59401 - The HttpClient4 implementation uncompresses the compressed response
but removes Content-Encoding response header when request has header
"Accept-Encoding = gzip, deflate"
Bugzilla Id: 59401

Modified:
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #4 from Milamber <mi...@apache.org> ---

This fix works for me. 
@philippe You want find another patch? (better patch?)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #9 from Sebb <se...@apache.org> ---
Created attachment 33819
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33819&action=edit
Test plan with different Accept-Encoding headers

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #6 from Sebb <se...@apache.org> ---
Seems to me that the HttpClient behaviour is correct; if it is asked to
decompress the content it must remove the headers.

If we want the original headers and content, then JMeter needs (as Oleg stated)
to stop HC from decompressing the response.

However JMeter will need to do the decompression itself. There's already code
to do this as I recall.

I think that is a better fix than intercepting the response.
It also offers the possibility of keeping the response as compressed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation haven't used compress when compress method included in Accept-Encoding[request header]

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om

--- Comment #1 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Thanks for report.
The response is zipped but indeed Content-Encoding is missing.

The size difference is due to differences in computation between HC4 and HC3.1

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #11 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Created attachment 33822
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33822&action=edit
Patch that saves only 3 headers in Context

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #8 from Sebb <se...@apache.org> ---
Created attachment 33818
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33818&action=edit
Alternative patch using temporary headers

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #7 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Hello sebb,
My current attached patch gets original headers without touching HC
decompression.

Yes there was in JMeter code to decompress, but :
- it only handles GZIP
- Not sure it correctly handles cases like 304 or 204

In what case would be need to keep the response compressed ? 

Do you intend to implement what you propose for 3.0 or for next 3.1 ?
Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation haven't used compress when compress method included in Accept-Encoding[request header]

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Hi,
Issue is due to HttpClient 4.5.X behaviour:
-
https://github.com/apache/httpclient/blob/4.5.x/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java#L142


When uncompressing HttpClient removes 3 headers:
- Content-Length                        
- Content-Encoding
- Content-MD5

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #16 from Sebb <se...@apache.org> ---
(In reply to Milamber from comment #14)
> That(In reply to Philippe Mouawad from comment #13)
> > (In reply to Sebb from comment #12)
> > > Created attachment 33823 [details]
> > > Alternative patch using Context
> > > 
> > > This avoids the Set and lowercasing.
> > > 
> > > It also allows for the headers not being deleted: the HC code actually has
> > > another check before uncompressing and removing them; also if the decompress
> > > fails presumably HC won't drop the headers.
> > > 
> > > We should not store them twice.
> > 
> > Ok for me
> 
> @Sebb @Philippe : That means we have a consensus with the last patch of
> Sebb? If yes, Sebb can you commit on the trunk, please.
> No blocker now to 3.0 RC4?

Not quite; I think we need to fix 59152 first (and perhaps 59429)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #13 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to Sebb from comment #12)
> Created attachment 33823 [details]
> Alternative patch using Context
> 
> This avoids the Set and lowercasing.
> 
> It also allows for the headers not being deleted: the HC code actually has
> another check before uncompressing and removing them; also if the decompress
> fails presumably HC won't drop the headers.
> 
> We should not store them twice.

Ok for me

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

--- Comment #5 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
There is a potential other fix that does is a copy paste of
ResponseContentEncoding but that does not remove the 3 headers.


Was discussing on HttpClient mailing list , subject : ResponseContentEncoding
behaviour in HttpClient 4.5.2 and 5.0

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33818|0                           |1
        is obsolete|                            |

--- Comment #10 from Sebb <se...@apache.org> ---
Created attachment 33821
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33821&action=edit
Alternative patch using temporary headers, v2

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59401] The HttpClient4 implementation uncompresses the compressed response but removes Content-Encoding response header when request has header "Accept-Encoding = gzip, deflate"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59401

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|The HttpClient4             |The HttpClient4
                   |implementation haven't used |implementation uncompresses
                   |compress when compress      |the compressed response but
                   |method included in          |removes Content-Encoding
                   |Accept-Encoding[request     |response header when
                   |header]                     |request has header
                   |                            |"Accept-Encoding = gzip,
                   |                            |deflate"

-- 
You are receiving this mail because:
You are the assignee for the bug.