Bug 54161 - Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Summary: Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.8
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2012-11-18 06:55 UTC by Etienne Carrière
Modified: 2012-11-18 10:08 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Etienne Carrière 2012-11-18 06:55:20 UTC

Here is my bug/patch proposal :
- Context : I have an application which do not respect the rules for x-www-form-urlencoded MIME-type. This application puts binary data in x-www-form-urlencoded POST data . 
- Goal : I would like to force Jmeter to use binary Sampler type for those request. 
- Current code : it is impossible as there is a specific case for x-www-form-urlencoded MIME-type
- Proposal : 

Index: src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
--- src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java  (revision 1410831)
+++ src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java  (working copy)
@@ -172,7 +172,7 @@
             // used when postData is pure xml (eg. an xml-rpc call) or for PUT
             } else if (postData.trim().startsWith("<?") || HTTPConstants.PUT.equals(sampler.getMethod())) {
                 sampler.addNonEncodedArgument("", postData, "");
-            } else if (contentType == null || contentType.startsWith(HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED) ){
+            } else if ((contentType == null || contentType.startsWith(HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED)) && (! isBinaryContent(contentType)) ){
                 // It is the most common post request, with parameter name and values
                 // We also assume this if no content type is present, to be most backwards compatible,
                 // but maybe we should only parse arguments if the content type is as expected

Best regards,

Etienne Carrière
Comment 1 Philippe Mouawad 2012-11-18 10:08:43 UTC
Applied with a change, test on binaryContent is done only if contentType != null.

Note you will have to change property:
- proxy.binary.types
to add application/x-www-form-urlencoded in your particular case.

Date: Sun Nov 18 10:06:44 2012
New Revision: 1410860

URL: http://svn.apache.org/viewvc?rev=1410860&view=rev
Bug 54161 - Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Bugzilla Id: 54161

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