Bug 54161

Summary: Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Product: JMeter - Now in Github Reporter: Etienne Carrière <etienne.carriere>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: enhancement CC: p.mouawad
Priority: P2    
Version: 2.8   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Etienne Carrière 2012-11-18 06:55:20 UTC
Hi,

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
Log:
Bug 54161 - Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Bugzilla Id: 54161

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
    jmeter/trunk/xdocs/changes.xml
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