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

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1807047&r1=1807046&r2=1807047&view=diff
==============================================================================
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
 Sat Sep  2 13:27:57 2017
@@ -1242,7 +1242,7 @@ public class HTTPHC4Impl extends HTTPHCA
         if(getUseMultipartForPost()) {
             // If a content encoding is specified, we use that as the
             // encoding of any parameter values
-            Charset charset = null;
+            Charset charset;
             if(haveContentEncoding) {
                 charset = Charset.forName(contentEncoding);
             } else {
@@ -1255,9 +1255,6 @@ public class HTTPHC4Impl extends HTTPHCA
             }
             // Write the request to our own stream
             MultipartEntityBuilder multipartEntityBuilder = 
MultipartEntityBuilder.create();
-            if(haveContentEncoding) {
-                multipartEntityBuilder.setCharset(charset);
-            }
             if(getDoBrowserCompatibleMultipart()) {
                 multipartEntityBuilder.setLaxMode();
             } else {
@@ -1271,12 +1268,7 @@ public class HTTPHC4Impl extends HTTPHCA
                 if (arg.isSkippable(parameterName)) {
                     continue;
                 }
-                StringBody stringBody;
-                if(haveContentEncoding) {
-                    stringBody = new StringBody(arg.getValue(), 
ContentType.create("text/plain", charset));
-                } else {
-                    stringBody = new StringBody(arg.getValue(), 
ContentType.create("text/plain"));
-                }
+                StringBody stringBody = new StringBody(arg.getValue(), 
ContentType.create("text/plain", charset));
                 FormBodyPart formPart = FormBodyPartBuilder.create(
                         parameterName, stringBody).build();
                 multipartEntityBuilder.addPart(formPart);

Modified: 
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java?rev=1807047&r1=1807046&r2=1807047&view=diff
==============================================================================
--- 
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
 (original)
+++ 
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
 Sat Sep  2 13:27:57 2017
@@ -1279,7 +1279,7 @@ public class TestHTTPSamplersAgainstHttp
         output.write("\"".getBytes(ISO_8859_1));
         output.write(CRLF);
         output.write("Content-Type: text/plain".getBytes(ISO_8859_1));
-        if(contentEncoding != null && 
!"US-ASCII".equalsIgnoreCase(contentEncoding)) {
+        if(contentEncoding != null) {
             output.write("; charset=".getBytes(ISO_8859_1));
             output.write(contentEncoding.getBytes(ISO_8859_1));
         }
@@ -1302,7 +1302,7 @@ public class TestHTTPSamplersAgainstHttp
         output.write("\"".getBytes(ISO_8859_1));
         output.write(CRLF);
         output.write("Content-Type: text/plain".getBytes(ISO_8859_1));
-        if(contentEncoding != null && 
!"US-ASCII".equalsIgnoreCase(contentEncoding)) {
+        if(contentEncoding != null) {
             output.write("; charset=".getBytes(ISO_8859_1));
             output.write(contentEncoding.getBytes(ISO_8859_1));
         }


Reply via email to