Created attachment 35202 [details] Don't add charset to multipart/form-data content type As reported by a few JMeter users on the users mailing list. IIS will not accept files that are send inside a multipart/form-data. It seems that the only difference between working (with other clients) and non-working (with JMeter) clients is the addition of a charset to the multipart/form-data content type. It seems that akka-http had the same problems as reported on https://github.com/akka/akka-http/issues/338 The attached patch removes the charset on the multipart content-type. The entities that are part of the multipart will remain there charsets.
Hi Felix, Is this issue related also to Bug 60800 ? Thanks
(In reply to Philippe Mouawad from comment #1) > Hi Felix, > Is this issue related also to Bug 60800 ? > Thanks And also Bug 56141 ?
(In reply to Philippe Mouawad from comment #2) > (In reply to Philippe Mouawad from comment #1) > > Hi Felix, > > Is this issue related also to Bug 60800 ? > > Thanks > > And also Bug 56141 ? Well 56141 looks related. And as comment 3 on that bug shows the same findings (it works better when the charset is not on the form-data), I think it is safe to apply this patch.
Will be included in version 3.3. Date: Fri Aug 25 19:02:36 2017 New Revision: 1806215 URL: http://svn.apache.org/viewvc?rev=1806215&view=rev Log: Don't set the charset on enclosing multipart/form-data header. It irritates some servers. The charset was added sometime back while refactoring to use a newer api of http client. See https://bz.apache.org/bugzilla/show_bug.cgi?id=56141 for more info. Bugzilla Id: 61384 Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java jmeter/trunk/xdocs/changes.xml
Created attachment 35258 [details] Alternative patch taking into account charset only if set
Created attachment 35259 [details] Test plan showing issue with current nightly build as of 27 august 2017
With attached plan, even If I have set UTF-8 charset, request sent corrupts file name: POST http://localhost:8081/ POST data: --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl Content-Disposition: form-data; name="toto" titi --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl Content-Disposition: form-data; name="chineseChar" 安 --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl Content-Disposition: form-data; name="test"; filename="?.jmx" Content-Type: text/plain <actual file content, not shown here> --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl-- [no cookies] Request Headers: Connection: keep-alive Content-Length: 2768 Content-Type: multipart/form-data; boundary=grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl Host: localhost:8081 User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_112)
*** Bug 60800 has been marked as a duplicate of this bug. ***
Author: pmouawad Date: Sun Aug 27 12:39:50 2017 New Revision: 1806358 URL: http://svn.apache.org/viewvc?rev=1806358&view=rev Log: Bug 61384 - Adding charset to multipart/form-data content type irritates IIS Bugzilla Id: 61384 Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Author: pmouawad Date: Sun Aug 27 12:54:56 2017 New Revision: 1806361 URL: http://svn.apache.org/viewvc?rev=1806361&view=rev Log: Bug 61384 - Adding charset to multipart/form-data content type irritates IIS Fix failing tests Bugzilla Id: 61384 Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Author: pmouawad Date: Sun Aug 27 13:44:44 2017 New Revision: 1806366 URL: http://svn.apache.org/viewvc?rev=1806366&view=rev Log: Bug 61384 - Adding charset to multipart/form-data content type irritates IIS Fix failing test Add test on param non corruption when charset is UTF-8 Bugzilla Id: 61384 Modified: jmeter/trunk/bin/testfiles/TEST_HTTP.jmx jmeter/trunk/bin/testfiles/TEST_HTTP_HttpClient4.csv jmeter/trunk/bin/testfiles/TEST_HTTP_HttpClient4.xml jmeter/trunk/bin/testfiles/TEST_HTTP_Java.csv jmeter/trunk/bin/testfiles/TEST_HTTP_Java.xml
Author: pmouawad Date: Sun Aug 27 14:14:36 2017 New Revision: 1806369 URL: http://svn.apache.org/viewvc?rev=1806369&view=rev Log: Bug 61384 - Adding charset to multipart/form-data content type irritates IIS Fix failing test Add test on param non corruption when charset is UTF-8 , second try Bugzilla Id: 61384 Modified: jmeter/trunk/bin/testfiles/TEST_HTTP_HttpClient4.xml jmeter/trunk/bin/testfiles/TEST_HTTP_Java.xml
Author: pmouawad Date: Sun Aug 27 17:49:03 2017 New Revision: 1806384 URL: http://svn.apache.org/viewvc?rev=1806384&view=rev Log: Bug 61384 - Adding charset to multipart/form-data content type irritates IIS Fix failing test: - Java Implementation corrupts parameter name for UTF-8, so add a check - Fix wrong CSV file for Java Bugzilla Id: 61384 Modified: jmeter/trunk/bin/testfiles/TEST_HTTP.jmx jmeter/trunk/bin/testfiles/TEST_HTTP_Java.csv
(In reply to Philippe Mouawad from comment #7) > With attached plan, even If I have set UTF-8 charset, request sent corrupts > file name: > POST http://localhost:8081/ > > POST data: > --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl > Content-Disposition: form-data; name="toto" > > titi > --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl > Content-Disposition: form-data; name="chineseChar" > > 安 > --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl > Content-Disposition: form-data; name="test"; filename="?.jmx" > Content-Type: text/plain > > <actual file content, not shown here> > --grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl-- > > > [no cookies] > > Request Headers: > Connection: keep-alive > Content-Length: 2768 > Content-Type: multipart/form-data; > boundary=grIHU42M9gTheYA5QVpw9uJAi6UAsLd8_QhLl > Host: localhost:8081 > User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_112) The file name is part of the header and has to be encoded (using quoted printable) separately. It is another problem.
Author: pmouawad Date: Sat Sep 2 13:27:57 2017 New Revision: 1807047 URL: http://svn.apache.org/viewvc?rev=1807047&view=rev Log: Bug 61384 - Adding charset to multipart/form-data content type irritates IIS Revert changes as per further analysis and jmeter/hc mailing lists answers Bugzilla Id: 61384 Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4460