Java implementation does well, providing required parameter:
POST http://localhost/api/file/upload/
POST data:
-----------------------------7d159c1302d0y0
Content-Disposition: form-data; name="jtl_file";
*filename="011f07efb04762311137.jtl.gz" *
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
<actual file content, not shown here>
-----------------------------7d159c1302d0y0--
Andrey Pokhilko
On 05/14/2015 07:57 PM, sebb wrote:
> On 14 May 2015 at 17:36, Andrey Pokhilko <[email protected]> wrote:
>> Hi,
>>
>> I'm trying to resolve a user issue when he claims that file upload
>> scenario is missing "filename" parameter. When I use HTTPClient4 I get
>> failing file upload request:
>>
>> POST http://localhost/api/file/upload/
>>
>> POST data:
>> --cJfjtjR2_380MwSzTd_SQdQfG51aS5D
>> Content-Disposition: form-data; name="jtl_file";
>> Content-Type: application/octet-stream
>>
>> <actual file content, not shown here>
>> --cJfjtjR2_380MwSzTd_SQdQfG51aS5D--
>>
>> While for HTTPClient3.1 I have successful request with:
>>
>> POST http://localhost/api/file/upload/
>>
>> POST data:
>> --wqkPl1L84AqGtph2Cgr79xYPJVMxntF4IJ
>> Content-Disposition: form-data; name="jtl_file";
>> *filename="011f023437.jtl.gz" *
>> Content-Type: application/octet-stream
>> Content-Transfer-Encoding: binary
>>
>> <actual file content, not shown here>
>> --wqkPl1L84AqGtph2Cgr79xYPJVMxntF4IJ--
>>
>>
>> After digging into HTTPClient4 implementation I found that we're really
>> do not pass filename parameter to underlying http library. This is easy
>> to fix by changing this line:
>> https://github.com/apache/jmeter/blob/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L966
>>
>> from
>>
>> super(file, mimeType);
>>
>> into:
>>
>> super(file, file.getName(), mimeType, null);
>>
>>
>> Questions:
>>
>> 1. Is that a bug? Maybe a known one? Or this is intended behavior.
> It would be useful to know what the Java implementation does.
>
>> 2. Should I fix this as demonstrated (if this is a bug)?
>>
>> --
>> Andrey Pokhilko
>>
>>
>>