Bug 54161 - Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Proxy : be able to create binary sampler for x-www-form-urlencoded POST request
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.8
All All
: P2 enhancement (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-11-18 06:55 UTC by Etienne Carrière
Modified: 2012-11-18 10:08 UTC (History)
1 user (show)



Attachments

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
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  (0)
+++ 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