Bug 62785 - Incomplete search path applied to the filenames used in the upload functionality of the HTTP sampler
Summary: Incomplete search path applied to the filenames used in the upload functional...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 5.0
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: JMETER_5.1
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks: 56197
  Show dependency tree
 
Reported: 2018-10-01 12:05 UTC by Artem Fedorov
Modified: 2019-03-02 18:24 UTC (History)
1 user (show)



Attachments
Test plan that reproduces this bug (5.09 KB, application/xml)
2018-10-01 13:03 UTC, Artem Fedorov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Artem Fedorov 2018-10-01 12:05:40 UTC
Config  'Files Upload` tab for reproduce:
  
<elementProp name="${__TestPlanName}" elementType="HTTPFileArg">
   <stringProp name="File.path">${__TestPlanName}</stringProp>
   <stringProp name="File.paramname"></stringProp>
   <stringProp name="File.mimetype"></stringProp>
</elementProp>

Method: POST
Use multipart/form-data: UNchecked

-----

Solution:
- add missed FileServer.getResolvedFile()
Comment 1 Artem Fedorov 2018-10-01 12:09:35 UTC
Fix https://github.com/apache/jmeter/pull/400
Comment 2 Philippe Mouawad 2018-10-01 12:55:52 UTC
Hello Artem,
Thanks for report and PR.

I don't think bug description is good, as if I put an absolute path and empty filename and mime type , it works.

I would say issue is more about finding relative file no ?
Comment 3 Artem Fedorov 2018-10-01 13:03:00 UTC
Hi Phillipe

The other additional requirement for reproduce this bug is the different JMeter_home and jmx_file_location.
Also I use just relative path in my example.

For example: 
I have my JMeter in /home/artem/apache-jmeter/ folder and I tried open the attached test plan from /home/artem/Downloads/ folder it will not work and will throws an exception.
Comment 4 Artem Fedorov 2018-10-01 13:03:28 UTC
Created attachment 36180 [details]
Test plan that reproduces this bug
Comment 5 Felix Schumacher 2018-10-01 20:10:17 UTC
I have to agree, that the title of this bug is misleading (the patch looks good).

The bug is an incomplete search path applied to the filenames used in the upload functionality of the http sampler, no?
Comment 6 Artem Fedorov 2018-10-02 08:25:57 UTC
Sure. I changed the bug label
Comment 7 Felix Schumacher 2018-10-03 09:56:40 UTC
Thanks for the nice patch (especially that it includes a test case :)
Will be included in the next version (which is probably 5.1)

Date: Wed Oct  3 09:54:37 2018
New Revision: 1842697

URL: http://svn.apache.org/viewvc?rev=1842697&view=rev
Log:
Incomplete search path applied to the filenames used in the upload functionality of the HTTP sampler

Implemented by Artem Fedorov (artem.fedorov at blazemeter.com) and contributed by BlazeMeter.

Closes #400 on github
Bugzilla Id: 62785
Comment 8 Vladimir Sitnikov 2019-03-01 08:41:19 UTC
@Felix, @Artem,

Just in case: the test case is wrong.
The test passes even without the changes to HTTPHC4Impl class.
Comment 9 Felix Schumacher 2019-03-02 16:45:34 UTC
@Vladimir
The test fails for me when I run it via "ant clean install test".

How did you run it?
Comment 10 Vladimir Sitnikov 2019-03-02 17:07:09 UTC
@Felix, I was running the test from IDE. Apparently the test relies on "current working directory" which is `jmeter_svn/bin/` in Ant case and `jmeter_svn/` in IDE.
Comment 11 Felix Schumacher 2019-03-02 17:08:41 UTC
That's what I thought. I am currently working on a better version, that works in both settings.
Comment 12 Felix Schumacher 2019-03-02 17:18:21 UTC
Date: Sat Mar  2 17:17:47 2019
New Revision: 1854657

URL: http://svn.apache.org/viewvc?rev=1854657&view=rev
Log:
Make test work in both IDE and ant setting

The test used the setting of CWD, which is different when run from an IDE or from ant.
Now it uses JMeterHome which is the same for both environments.

And while we are at the test,
 * we try to make sure, that we don't disturb other tests with the manipulated base dir
 * use more descriptive messages in the case of a failure

Relates to #400 on github
Bugzilla Id: 62785
Comment 13 Felix Schumacher 2019-03-02 18:24:32 UTC
Date: Sat Mar  2 18:23:39 2019
New Revision: 1854660

URL: http://svn.apache.org/viewvc?rev=1854660&view=rev
Log:
Add License header to new test class

Relates to #400 on github
Bugzilla Id: 62785


Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestSerializedHTTPSampler.java
Comment 14 The ASF infrastructure team 2022-09-24 20:38:14 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4885