Bug 54293 - JMeter rejects html tags '<' in query params as invalid when they are accepted by the browser
Summary: JMeter rejects html tags '<' in query params as invalid when they are accept...
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.8
Hardware: All All
: P4 minor (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on: 54482
  Show dependency tree
Reported: 2012-12-13 17:01 UTC by oliver lloyd
Modified: 2013-08-07 00:16 UTC (History)
1 user (show)

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

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).


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:
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
Bug 54293 - JMeter rejects html tags '<' in query params as invalid when they are accepted by the browser
Bugzilla Id: 54293

Comment 8 Philippe Mouawad 2013-04-11 20:19:35 UTC
Fix introduces regressions on this kind of URLs
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
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

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:

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
Clarify behaviour when path contains a full URL

Comment 14 The ASF infrastructure team 2022-09-24 20:37:52 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3016