Bug 65024 - Sending mime type with parameter throws IllegalArgumentException
Summary: Sending mime type with parameter throws IllegalArgumentException
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 5.4
Hardware: PC All
: P2 normal (vote)
Target Milestone: JMETER 5.4.1
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2020-12-22 11:36 UTC by lukasz.pyrzyk
Modified: 2021-01-15 18:05 UTC (History)
0 users



Attachments
Usage of the mime type with parameter (117.84 KB, image/png)
2020-12-22 11:36 UTC, lukasz.pyrzyk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lukasz.pyrzyk 2020-12-22 11:36:20 UTC
Created attachment 37642 [details]
Usage of the mime type with parameter

It is not possible to send a file with multipart/form-data with mime type "text/html; charset=UTF-8" or any other MIME type that contains a parameter.


java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:229)
    at org.apache.http.entity.ContentType.create(ContentType.java:241)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.setupHttpEntityEnclosingRequestData(HTTPHC4Impl.java:1575)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:886)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:641)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:635)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.base/java.lang.Thread.run(Thread.java:830)


Issue was confirmed on the mailing list by @Felix Schumacher.
Comment 1 Felix Schumacher 2020-12-22 15:22:38 UTC
Can you try out the next nightly build or the next build from trunk and report back, whether it fixes your issue?


commit 61e6e69c575cbc34a04a879ffe9b920206563904
AuthorDate: Tue Dec 22 16:19:23 2020 +0100

    Sending mime type with parameter throws IllegalArgumentException
    
    The create method of ContentType doesn't work with mime-types that
    contain multiple parts (separated by semicolons). The parse method
    does, so use that one.
    
    Bugzilla Id: 65024
---
 .../jmeter/protocol/http/sampler/HTTPHC4Impl.java  | 12 +++++--
 .../protocol/http/sampler/TestHTTPHC4Impl.java     | 40 ++++++++++++++++++++++
 xdocs/changes.xml                                  |  1 +
 3 files changed, 51 insertions(+), 2 deletions(-)
Comment 2 lukasz.pyrzyk 2020-12-22 16:08:34 UTC
Just checked on apache-jmeter-5.4.1-SNAPSHOT from https://ci-builds.apache.org/job/JMeter/job/JMeter-trunk/ and it works great, no issues. 

When can we expect a 5.4.1 release?
Comment 3 Felix Schumacher 2020-12-31 14:20:56 UTC
Can't give a precise estimation of release date, but it should not take long now.
Comment 4 Felix Schumacher 2021-01-15 18:05:10 UTC
commit 551339a0fce6bb84d72982772951f11ba3a8a5a1
AuthorDate: Fri Jan 15 18:38:23 2021 +0100

    Remove left-over constant that is not used anymore.
    
    Cleanup after commit f045cf5e1604c68b7d43986fe9bd82a102fa2b76
    Bugzilla Id: 65024
---
 .../apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java   | 1 -
 1 file changed, 1 deletion(-)
Comment 5 The ASF infrastructure team 2022-09-24 20:38:21 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5470