Bug 63298

Summary: HTTP Requests with encoded URLs are being sent in decoded format
Product: JMeter - Now in Github Reporter: alan.hill <alan.hill>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal CC: alan.hill, p.mouawad
Priority: P2 Keywords: FixedInTrunk
Version: 5.1.1   
Target Milestone: JMETER_5.2   
Hardware: PC   
OS: All   

Description alan.hill 2019-03-28 14:22:08 UTC
We have performance tests written in jmeter4 that work without issue.  When upgrading to jmeter5, we find that some of our http requests against paths with encoded URLs are failing.

In addition in the jmeter "view results tree" view it appears the url is submitted properly in an encoded format, but enabling debug tracing in jmeter reveals it's actually sent on the wire in decoded format, which is failing.

Here is some logging to show:

Sample start showing the URL (encoded).  This is also what appears on the view results tree view.

2019-03-27 16:04:22,342 DEBUG o.a.j.p.h.s.HTTPHC4Impl: Start : sample https://na1.mist60.stm.salesforce.com/l/%7B%22mode%22%3A%22PROD%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22BD4UGoez245sNnTgn1sJJg%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22135UFXBjK_Gvtd9UYV4RBg%22%7D%2C%22pathPrefix%22%3A%22%22%2C%22ls%22%3A1%7D/inline.js?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..f0IY0OClHp9yDCIRblhyGsZ6nZTWQ3wm7KNHTqHFHnU method GET followingRedirect false depth 0
2019-03-27 16:04:22,342 DEBUG o.a.j.p.h.s.HTTPHC4Impl: Reusing the HttpClient: @1408486438 https://na1.mist60.stm.salesforce.com
2019-03-27 16:04:22,343 DEBUG o.a.j.p.h.c.HC4CookieHandler: Found 13 cookies for https://na1.mist60.stm.salesforce.com/l/%7B%22mode%22%3A%22PROD%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22BD4UGoez245sNnTgn1sJJg%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22135UFXBjK_Gvtd9UYV4RBg%22%7D%2C%22pathPrefix%22%3A%22%22%2C%22ls%22%3A1%7D/inline.js?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..f0IY0OClHp9yDCIRblhyGsZ6nZTWQ3wm7KNHTqHFHnU
2019-03-27 16:04:22,343 DEBUG o.a.j.p.h.s.HTTPHC4Impl: Found user token:Thread Group 1-1 as JMeter variable:__jmeter.U_T__, storing it in HttpContext
2019-03-27 16:04:22,343 DEBUG o.a.h.c.p.RequestAddCookies: CookieSpec selected: default
2019-03-27 16:04:22,343 DEBUG o.a.h.c.p.RequestAddCookies: Unsupported cookie policy: default
2019-03-27 16:04:22,343 DEBUG o.a.h.c.p.RequestAuthCache: Auth cache not set in the context
2019-03-27 16:04:22,343 DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager: Connection request: [route: {s}->https://na1.mist60.stm.salesforce.com:443][state: Thread Group 1-1][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
2019-03-27 16:04:22,343 DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager: Connection leased: [id: 24][route: {s}->https://na1.mist60.stm.salesforce.com:443][state: Thread Group 1-1][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2019-03-27 16:04:22,343 DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection: http-outgoing-24: set socket timeout to 0 

See decoded requests here:

2019-03-27 16:04:22,343 DEBUG o.a.h.i.e.MainClientExec: Executing request GET /l/%7B%22mode%22:%22PROD%22,%22app%22:%22one:one%22,%22fwuid%22:%22BD4UGoez245sNnTgn1sJJg%22,%22loaded%22:%7B%22APPLICATION@markup:/one:one%22:%22135UFXBjK_Gvtd9UYV4RBg%22%7D,%22pathPrefix%22:%22%22,%22ls%22:1%7D/inline.js?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..f0IY0OClHp9yDCIRblhyGsZ6nZTWQ3wm7KNHTqHFHnU HTTP/1.1 
2019-03-27 16:04:22,343 DEBUG o.a.h.i.e.MainClientExec: Target auth state: UNCHALLENGED
2019-03-27 16:04:22,343 DEBUG o.a.h.i.e.MainClientExec: Proxy auth state: UNCHALLENGED
2019-03-27 16:04:22,344 DEBUG o.a.h.headers: http-outgoing-24 >> GET /l/%7B%22mode%22:%22PROD%22,%22app%22:%22one:one%22,%22fwuid%22:%22BD4UGoez245sNnTgn1sJJg%22,%22loaded%22:%7B%22APPLICATION@markup:/one:one%22:%22135UFXBjK_Gvtd9UYV4RBg%22%7D,%22pathPrefix%22:%22%22,%22ls%22:1%7D/inline.js?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..f0IY0OClHp9yDCIRblhyGsZ6nZTWQ3wm7KNHTqHFHnU HTTP/1.1


Workaround:
Using the HTTP Request Defaults config option - if you set the client implementation to "java" explicitly, the requests work.
Comment 1 Philippe Mouawad 2019-04-01 20:12:15 UTC
Hello,
I suspect this is due to :

https://jira.apache.org/jira/browse/HTTPCLIENT-1968

Can you try to replace HttpClient by version 4.5.8 and see if it works ?

Thanks
Comment 2 alan.hill 2019-04-02 12:43:40 UTC
Yes, using http client 4.5.8 works well.  Will this be added in a jmeter release by default coming up?  Is the recommendation just to patch the http client jar for now?
Comment 3 Philippe Mouawad 2019-04-02 20:41:13 UTC
Author: pmouawad
Date: Tue Apr  2 20:39:58 2019
New Revision: 1856845

URL: http://svn.apache.org/viewvc?rev=1856845&view=rev
Log:
Bug 63298 - HTTP Requests with encoded URLs are being sent in decoded format
Bugzilla Id: 63298

Modified:
    jmeter/trunk/LICENSE
    jmeter/trunk/build.properties
    jmeter/trunk/eclipse.classpath
    jmeter/trunk/lib/   (props changed)
    jmeter/trunk/lib/aareadme.txt
    jmeter/trunk/res/maven/ApacheJMeter_parent.pom
    jmeter/trunk/xdocs/changes.xml
Comment 4 alan.hill 2019-04-16 12:48:21 UTC
(In reply to Philippe Mouawad from comment #3)
> Author: pmouawad
> Date: Tue Apr  2 20:39:58 2019
> New Revision: 1856845
> 
> URL: http://svn.apache.org/viewvc?rev=1856845&view=rev
> Log:
> Bug 63298 - HTTP Requests with encoded URLs are being sent in decoded format
> Bugzilla Id: 63298
> 
> Modified:
>     jmeter/trunk/LICENSE
>     jmeter/trunk/build.properties
>     jmeter/trunk/eclipse.classpath
>     jmeter/trunk/lib/   (props changed)
>     jmeter/trunk/lib/aareadme.txt
>     jmeter/trunk/res/maven/ApacheJMeter_parent.pom
>     jmeter/trunk/xdocs/changes.xml

How will this fix be delivered exactly?  Will there be a new version of jmeter published publicly with this?
Comment 5 Felix Schumacher 2019-04-17 16:10:30 UTC
The fix is included in trunk, so it will be made "public" with the next release. There is no fixed date for the next release.
Comment 6 The ASF infrastructure team 2022-09-24 20:38:16 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5040