Bug 60084 - JMeter 3.0 embedded resource URL is silently encoded
Summary: JMeter 3.0 embedded resource URL is silently encoded
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 3.0
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-05 10:06 UTC by Stuart Barlow
Modified: 2016-09-12 14:27 UTC (History)
1 user (show)



Attachments
Simple test plan with HTTPRequest configured to download embedded resources (5.65 KB, application/xml)
2016-09-05 10:06 UTC, Stuart Barlow
Details
Patch proposal to fix issue (4.01 KB, patch)
2016-09-10 22:05 UTC, Philippe Mouawad
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Barlow 2016-09-05 10:06:38 UTC
Created attachment 34199 [details]
Simple test plan with HTTPRequest configured to download embedded resources

Hi all.

I'm migrating all of my tests to JMeter 3.0 and found some 
that worked fine with earlier versions now fail with 3.0. The 
problem is with HTTP Request embedded resources. I'm using Java 1.7.0_45

A HTTP Request is configured to download all embedded resources but if 
a resource contains some special characters (like '+'), they are 
automatically encoded before being downloaded. This breaks the test.

For example, if the parent HTML contains something like this:

<img alt="Captcha" class="captcha-image" width="100" height="50" 
src="/IqGo6EM1JEVZ+MSRJqUSo@qhjVMSFBTs/37/0/1"/>

The + is encoded as %20 and is then unreachable. A HTTP 500 is returned 
instead of the expected content.

Is there a configuration parameter to control this? Or is this a bug?

I have attached a very simple .jmx file to allow you to easily reproduce the problem. You'll also need to create and deploy a HTML containing the above markup to your web server of choice.

Bug 58137 seems like a close match. Did the fix to this bug create the issue I am now seeing? 

Thank you!

Stuart
Comment 1 Philippe Mouawad 2016-09-07 11:52:25 UTC
Hi,
Thanks for opening the bug and providing test case.
I'll try to analyze it asap this week.

Regards
Comment 2 Philippe Mouawad 2016-09-10 14:52:16 UTC
Hello,
Your issue is due to fix of Bug 58137.
It appears an url containing + is valid, our processing to escapeIllegal leads to the change from + to %20.


I think we should switch this part of code to use :
https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/UrlValidator.html


But anyway I tested using org.apache.commons.validator.routines.UrlValidator#isValid and your URL appears no to be.
I asked a question on commons user mailing list.
"Question about URLValidator#isValid"

Once I get an answer we'll see what to do.
Regards
Comment 3 Philippe Mouawad 2016-09-10 22:05:29 UTC
Created attachment 34230 [details]
Patch proposal to fix issue
Comment 4 Philippe Mouawad 2016-09-11 13:39:57 UTC
Author: pmouawad
Date: Sun Sep 11 13:39:13 2016
New Revision: 1760249

URL: http://svn.apache.org/viewvc?rev=1760249&view=rev
Log:
Bug 60084 - JMeter 3.0 embedded resource URL is silently encoded
Bugzilla Id: 60084

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java
    jmeter/trunk/xdocs/changes.xml
Comment 5 Stuart Barlow 2016-09-12 14:27:30 UTC
Those updates fixed the problem. 
Thank you Philippe.
Comment 6 The ASF infrastructure team 2022-09-24 20:38:05 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4090