Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value is trimmed when sending the request in Multipart #2433

Closed
asfimport opened this issue Dec 1, 2010 · 6 comments
Closed

value is trimmed when sending the request in Multipart #2433

asfimport opened this issue Dec 1, 2010 · 6 comments

Comments

@asfimport
Copy link
Collaborator

Kanagamahendran Velusamy (Bug 50392):
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.

Severity: major
OS: Linux

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
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.

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
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?

@asfimport
Copy link
Collaborator Author

Kanagamahendran Velusamy (migrated from Bugzilla):
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?

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Thanks!
I'd not specified the enctype.
Adding enctype="multipart/form-data" now works with FF.

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Fixed in SVN:

URL: http://svn.apache.org/viewvc?rev=1041406&view=rev
Log:
#2433 - 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

@asfimport
Copy link
Collaborator Author

Kanagamahendran Velusamy (migrated from Bugzilla):
Thank you .You are Amazing!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant