Bug 50392 - value is trimmed when sending the request in Multipart
value is trimmed when sending the request in Multipart
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.4
PC Linux
: P2 major (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-12-01 10:51 UTC by Kanagamahendran Velusamy
Modified: 2010-12-02 10:36 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kanagamahendran Velusamy 2010-12-01 10:51:07 UTC
When user agent submit a request which is POST/Multipart to Jmeter Http Proxy server, for the key and value arguments,value filed is being trimmed which is totally wrong. what if the value field is depend on the space?

i figured out where is the problem and its in org.apache.jmeter.protocol.http.config.MultipartUrlConfig 

i added the below code in parseArquments method and removed the trim part

/*
                     * Bug Fix
                     * Do not trim the value,just remove the extra char's appended with value in the process.
                     * value always contains \n\r\n<value>\r\n 
                     */
                    if(value!=null)
                    {
                    	if(value.length()>=3&&value.substring(0,3).equals("\n\r\n"))
                    	{
                    		value=value.substring(3);
                    	}                    	
                    	if(value.length()>=2&&value.substring(value.length()-2).equals("\r\n"))
                    	{
                    		value=value.substring(0,value.length()-2);
                    	}
                    }   

Please let me know if you need any more info.
Comment 1 Sebb 2010-12-02 09:37:03 UTC
Thanks! 

I agree, there is a problem with the parsing of values - it should only strip the initial blank line and the trailing EOL.

BTW, I'm not quite sure why the code allows for "\n\n" (LFLF); AFAIK, CRLF is the only permitted EOL marker. However I think that option should be kept for now.
Comment 2 Sebb 2010-12-02 09:46:48 UTC
I've just tried to generate form data with trailing spaces in browsers, but IE, FF and Opera all convert trailing spaces to +.

So what user agent caused the problem for you?
Comment 3 Kanagamahendran Velusamy 2010-12-02 09:51:44 UTC
Keep the form as multipart so that it will be sent as it is
I used FF.
(In reply to comment #2)
> I've just tried to generate form data with trailing spaces in browsers, but IE,
> FF and Opera all convert trailing spaces to +.
> 
> So what user agent caused the problem for you?
Comment 4 Sebb 2010-12-02 10:12:09 UTC
Thanks! 
I'd not specified the enctype. 
Adding  enctype="multipart/form-data" now works with FF.
Comment 5 Sebb 2010-12-02 10:26:03 UTC
Fixed in SVN:

URL: http://svn.apache.org/viewvc?rev=1041406&view=rev
Log:
Bug 50392 - value is trimmed when sending the request in Multipart

Modified:
   jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
   jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 6 Kanagamahendran Velusamy 2010-12-02 10:36:24 UTC
Thank you .You are Amazing!.