|Summary:||URLs get encoded on redirects in HC3.1 & HC4 samplers|
|Component:||HTTP||Assignee:||JMeter issues mailing list <issues>|
Description ateles.belzebuth.hybridus+apache 2014-03-03 12:08:59 UTC
referred to: HTTP Sampler, HTTP Proxy Server When JMeter follows a redirect (upon a HTTP 302 response) some characters get an unnecessary %-encoding in the URL of the new request, causing some dumb web applications fail. Example: Server response: HTTP/1.1 302 Found Location: /otrs/index.pl?Action=AgentTicketSearch;Subaction=AJAX ... JMeter request: GET /otrs/index.pl?Action=AgentTicketSearch%3BSubaction%3DAJAX HTTP/1.1 ... This behavior did not occur in 2.9. In the obsoleted RFC 2396 ';', '/' and some other characters where not allowed in the query string. In the recent RFC 3986 (STD 66) the rule was relaxed and these are now vaild characters in a query string. Most browsers do also not encode these characters and pass the URL in the same way as they received it in the Location header (exept for the #fragment part). This issue might be related to Bug 54482
Comment 1 Sebb 2014-03-05 23:01:02 UTC
The problem seems to be that the code calls ConversionUtils.sanitizeUrl which uses the HttpComponents class org.apache.http.client.utils.URIBuilder to recreate the URL from its component parts. Not sure why, but that uses the same encoding as for form fields. It should probably be using a less restrictive set of safe characters for query encoding.
Comment 2 Sebb 2014-03-05 23:11:09 UTC
Looks like this has been fixed in URIBuilder in HC 3.4
Comment 3 Sebb 2014-03-08 11:12:10 UTC
An alternative might be to use the URI class for encoding. See also Bug 56231
Comment 4 ateles.belzebuth.hybridus+apache 2014-03-12 02:25:02 UTC
An similar issue occur with characters outside the allowed set. I came across a web application which insists of using an unencoded pipe sigen ("|", %7C) as part of the query string. I consider this as a bug of that application, but browsers allow this. Therefore JMeter should allow this also, if the option "Encode" is not checked in the HTML-Sampler.
Comment 5 Sebb 2014-03-13 13:32:57 UTC
(In reply to ateles.belzebuth.hybridus+apache from comment #4) > An similar issue occur with characters outside the allowed set. I came > across a web application which insists of using an unencoded pipe sigen > ("|", %7C) as part of the query string. I consider this as a bug of that > application, but browsers allow this. Therefore JMeter should allow this > also, if the option "Encode" is not checked in the HTML-Sampler. The Encode option does not apply to redirects - it applies to specific parameters on the HTTP Sampler screem. If there is a problem with samples containing a pipe sign in the query string, please raise a separate issue for that.
Comment 6 Sebb 2014-03-17 00:51:58 UTC
URL: http://svn.apache.org/r1578190 Log: URLs get encoded on redirects in HC3.1 & HC4 samplers Only encode if URL is not correctly encoded Bugzilla Id: 56207 Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/ConversionUtils.java jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java jmeter/trunk/xdocs/changes.xml