Bug 52781

Summary: Content-Disposition header garbled even if browser compatible headers is checked (HC4)
Product: JMeter - Now in Github Reporter: Tetsuya Takatsuru <takatsuru.tetsuya>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal CC: p.mouawad
Priority: P2    
Version: 2.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: patch on HTTPHC4Impl

Description Tetsuya Takatsuru 2012-02-28 06:24:56 UTC
Some browsers (IE, FF, Opera, etc...) uses raw filename for "filename" parameter of Content-Disposition header in the part of multipart post request.

for example:

-----(bounary)-----
Content-Disposition: form-data; name="uploadFile"; filename="私の添付ファイル.txt"
Content-Type: text/plain

... (content of file)
-----(bounary)-----

Now, the filename is changed to "????????.txt" regardless of "browser compatible headers" option:

-----(bounary)-----
Content-Disposition: form-data; name="uploadFile"; filename="????????.txt"
Content-Type: text/plain

... (content of file)
-----(bounary)-----

However, HTTPHC4Impl is expected to send request the same as browsers when "browser compatible mode" is checked.

Charset is needed for constructor of MultipartEntity so that browser compatible mode works correctly.
Here is a patch fixing it.
Comment 1 Tetsuya Takatsuru 2012-02-28 06:27:44 UTC
Created attachment 28394 [details]
patch on HTTPHC4Impl
Comment 2 Philippe Mouawad 2012-02-28 12:06:55 UTC
Applied partly with fix when content encoding is empty or null.
Also fixed Test Case TestHTTPSamplersAgainstHttpMirrorServer that computed wrong boundary


Date: Tue Feb 28 10:03:45 2012
New Revision: 1294541

URL: http://svn.apache.org/viewvc?rev=1294541&view=rev
Log:
Bug 52781 - Content-Disposition header garbled even if browser compatible headers is checked (HC4)

Modified:
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java

Date: Tue Feb 28 12:03:41 2012
New Revision: 1294596

URL: http://svn.apache.org/viewvc?rev=1294596&view=rev
Log:
Bug 52781 - Content-Disposition header garbled even if browser compatible headers is checked (HC4)
Handle correctly null contentEncoding

Modified:
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java


Date: Tue Feb 28 12:05:02 2012
New Revision: 1294598

URL: http://svn.apache.org/viewvc?rev=1294598&view=rev
Log:
Bug 52781 - Content-Disposition header garbled even if browser compatible headers is checked (HC4)
Fixed wrong Boundary extraction

Modified:
   jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Comment 3 Philippe Mouawad 2012-02-28 12:37:33 UTC
Thanks for patch and clear submission.
Comment 4 The ASF infrastructure team 2022-09-24 20:37:49 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2753