Bug 54293 - JMeter rejects html tags '<' in query params as invalid when they are accepted by the browser
JMeter rejects html tags '<' in query params as invalid when they are accept...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.8
All All
: P4 minor (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on: 54482
Blocks:
  Show dependency tree
 
Reported: 2012-12-13 17:01 UTC by oliver lloyd
Modified: 2013-08-07 00:16 UTC (History)
1 user (show)



Attachments
Example jmx (9.78 KB, application/octet-stream)
2012-12-13 21:37 UTC, oliver lloyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description oliver lloyd 2012-12-13 17:01:01 UTC
The URI below is a valid SOLR request but it is rejected by JMeter with the error given. It appears that the '<' char is being rejected (the index 181 actually refers to this character).

http://my-solr-server.com/solr/collection1/select/?facet=true&facet.mincount=1&spellcheck.extendedResults=true&spellcheck.q=lego+land&hl.simple.pre=<strong>&wt=xml&version=2.2&rows=10&spellcheck.accuracy=0.8&start=0&q=lego+land&hl.simple.post=</strong>&qt=sun

Response code: Non HTTP response code: java.net.URISyntaxException
Response message: Non HTTP response message: Illegal character in query at index 181:

Putting html tags as query params is an odd thing to do but nonetheless the browser and server will accept this request and I am served valid results in response in order to run a valid test with representative requests I need JMeter to accept and send this request.
Comment 1 Sebb 2012-12-13 21:25:25 UTC
There are various different ways of doing this in JMeter.

Please attach the simplest JMX file which shows how you are creating the request.
Comment 2 oliver lloyd 2012-12-13 21:37:49 UTC
Created attachment 29752 [details]
Example jmx

Example lines from data file:
facet=true&facet.mincount=1&spellcheck.extendedResults=true&spellcheck.q=miliband+wallace&hl.simple.pre=<strong>&wt=xml&rows=10&version=2.2&spellcheck.accuracy=0.8&start=0&q=miliband+wallace&hl.simple.post=</strong>&qt=sun
wt=xml&rows=3&version=2.2&start=0&q=miliband+wallace&qt=bestLinks&fq=bestlinks_context:sun+OR+bestlinks_context:StoTtoSun
facet=true&facet.mincount=1&spellcheck.extendedResults=true&spellcheck.q=50+shades+of+grey&hl.simple.pre=<strong>&wt=xml&rows=10&version=2.2&spellcheck.accuracy=0.8&start=0&q=50+shades+of+grey&hl.simple.post=</strong>&qt=sun
wt=xml&rows=3&version=2.2&start=0&q=50+shades+of+grey&qt=bestLinks&fq=bestlinks_context:sun+OR+bestlinks_context:StoTtoSun
facet=true&facet.mincount=1&spellcheck.extendedResults=true&spellcheck.q=germans&hl.simple.pre=<strong>&wt=xml&rows=10&version=2.2&spellcheck.accuracy=0.8&start=0&q=germans&hl.simple.post=</strong>&qt=sun
Comment 3 oliver lloyd 2012-12-13 21:48:40 UTC
File attached.

I looked into this further and I am only seeing this error when using either the HttpClient3.1 & HttpClient4 implementations. The original jmx was using the default - blank - option for this select field which, I presume, uses one of these. When I select Java for the implementation value I do not see this issue and the request is made as expected.

It could well be that this is the correct response based on the implementation. I'm happy to close this issue in that case.
Comment 4 Sebb 2012-12-13 22:12:50 UTC
The JMX file uses the path field to provide the full path, including the parameters.

There's no option to encode this - afaik path names don't have to be encoded.

So you'll need to encode the relevant parts of the field, or put the parameters into the appropriate fields on the form.
Comment 5 Casey Dunham 2013-01-14 22:18:08 UTC
The query portion of the URL should always be URL encoded.
Comment 6 Philippe Mouawad 2013-02-04 21:58:00 UTC
Fixed within 54482 fix
Comment 7 Philippe Mouawad 2013-02-04 22:04:01 UTC
Date: Mon Feb  4 22:03:18 2013
New Revision: 1442393

URL: http://svn.apache.org/viewvc?rev=1442393&view=rev
Log:
Bug 54293 - JMeter rejects html tags '<' in query params as invalid when they are accepted by the browser
Bugzilla Id: 54293

Modified:
    jmeter/trunk/xdocs/changes.xml
Comment 8 Philippe Mouawad 2013-04-11 20:19:35 UTC
Fix introduces regressions on this kind of URLs
http://XXX.XXXX.com/toto_titi_tata/CatalogData/ItemImages\IJ\Items_1152\07_06_015_Na_0_0_0_Aucune_0_Na_Na_Batik_s.jpg
Comment 9 Philippe Mouawad 2013-04-11 20:25:53 UTC
Date: Thu Apr 11 20:24:48 2013
New Revision: 1467074

URL: http://svn.apache.org/r1467074
Log:
Rollback to fix of bugs:
54482- HC fails to follow redirects with non-encoded chars
54293- JMeter rejects html tags '&lt;' in query params as invalid when they are accepted by the browser
54142- HTTP Proxy Server throws an exception when path contains "|" character

Bugzilla Id: 54482,54293,54142

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/xdocs/changes.xml
Comment 10 Sebb 2013-04-12 10:03:00 UTC
Note that Firefox, Opera and Chrome all encode the < and > before contacting the server.

IE 8 does not seem to do so; that is probably a bug in IE.

I'm inclined to close this as won't fix or perhaps invalid.

===

BTW, an easy way to check what browsers do is to run the JMeter mirror server, and then use the browser with a URL such as:

http://localhost:8081/solr/?<>
Comment 11 Sebb 2013-04-12 10:06:46 UTC
We should probably document that the behaviour of JMeter for URLs provided as a full path is different from the behaviour where the URL is provided via parameters.
Comment 12 Philippe Mouawad 2013-08-03 21:32:43 UTC
I agree with you sebb.
Recording this kind of URL by JMeter Proxy leads to correct HTTP Sampler configuration, all parameters are correctly encoded.
What is the best place for documenting this ? HTTP Sampler documentation ?
Comment 13 Sebb 2013-08-07 00:16:37 UTC
URL: http://svn.apache.org/r1511153
Log:
Clarify behaviour when path contains a full URL

Modified:
    jmeter/trunk/xdocs/usermanual/component_reference.xml