jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Pokhilko <a...@ya.ru>
Subject Re: HTTPClient4 missing filename for file uploads
Date Fri, 15 May 2015 11:39:03 GMT
Very predictable.

Andrey Pokhilko

On 05/15/2015 02:24 PM, sebb wrote:
> Seems to me that this is not a bug in JMeter.
>
> It may perhaps be a bug in a later version of HttpComponents, but
> JMeter is not currently using that version.
> Before adding code to JMeter, I think we need to determine whether it
> is a bug in HC.
>
> I don't think we need to fix JMeter to support customised installations.
> Since JMeter is open source, the user can apply the fix for themselves.
>
> Once we have determined whether of not this is a bug in HC, we can
> determine whether or not JMeter needs to be updated when it is
> upgraded to the latest version of HC.
>
>
>
> On 15 May 2015 at 11:04, Andrey Pokhilko <apc4@ya.ru> wrote:
>> Right.
>>
>> Andrey Pokhilko
>>
>> On 05/15/2015 12:55 PM, UBIK LOAD PACK Support wrote:
>>> AFAIU, setting name would not break existing behaviour and fix the
>>> situation right ?
>>>
>>>
>>> On Fri, May 15, 2015 at 11:50 AM, Andrey Pokhilko <apc4@ya.ru> wrote:
>>>
>>>> I investigated it more. It happened that with stock httpmime-4.2.6 it
>>>> works, but user has upgraded HTTPComponents libraries to support custom
>>>> plugins. Since version 4.3 of httpmime they deprecated that constructor
>>>> and don't have automatic logic to set filename from file if filename is
>>>> null.
>>>>
>>>> This seems to be a deadlock situation for user unless we're making a
>>>> step towards custom plugin users and will call different super-constructor.
>>>>
>>>> Sebb, what's your opinion?
>>>>
>>>> Andrey Pokhilko
>>>>
>>>> On 05/15/2015 12:05 AM, sebb wrote:
>>>>> OK, it does look like a bug, but according to the source for http mime
>>>>> 4.2.6 if filename is null it uses file.getName() anyway, so AFAICT
>>>>> your proposed fix would have no effect.
>>>>>
>>>>> This needs further investigation.
>>>>>
>>>>> On 14 May 2015 at 19:00, Andrey Pokhilko <apc4@ya.ru> wrote:
>>>>>> 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 <apc4@ya.ru> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>


Mime
View raw message