You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/03 18:24:12 UTC

[tomcat] branch master updated (b30bd06 -> a2a124e)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from b30bd06  Fix typo. Better test coverage.
     new 53f678e  Don't mutate a valid Content-type if it does not contain a charset
     new d74a05d  Remove work-around for buggy Adobe Reader plug-in 9 on IE
     new a2a124e  Update changelog

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/connector/Response.java       | 12 ++++++++++--
 java/org/apache/coyote/Response.java                   |  9 ++++++++-
 java/org/apache/tomcat/util/http/parser/MediaType.java |  4 ----
 test/org/apache/coyote/TestResponse.java               |  2 --
 webapps/docs/changelog.xml                             |  5 +++++
 5 files changed, 23 insertions(+), 9 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/03: Don't mutate a valid Content-type if it does not contain a charset

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 53f678ed9a0f9ff81abb6650fb0e553278a2a319
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Apr 3 19:20:34 2020 +0100

    Don't mutate a valid Content-type if it does not contain a charset
---
 java/org/apache/catalina/connector/Response.java | 12 ++++++++++--
 java/org/apache/coyote/Response.java             |  9 ++++++++-
 test/org/apache/coyote/TestResponse.java         |  2 --
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index 9e4b77e..af9c811 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -734,9 +734,17 @@ public class Response implements HttpServletResponse {
             return;
         }
 
-        getCoyoteResponse().setContentTypeNoCharset(m[0]);
 
-        if (m[1] != null) {
+        if (m[1] == null) {
+            // No charset and we know value is valid as cache lookup was
+            // successful
+            // Pass-through user provided value in case user-agent is buggy and
+            // requires specific format
+            getCoyoteResponse().setContentTypeNoCharset(type);
+        } else {
+            // There is a charset so have to rebuild content-type without it
+            getCoyoteResponse().setContentTypeNoCharset(m[0]);
+
             // Ignore charset if getWriter() has already been called
             if (!usingWriter) {
                 try {
diff --git a/java/org/apache/coyote/Response.java b/java/org/apache/coyote/Response.java
index 38cc609..91473a1 100644
--- a/java/org/apache/coyote/Response.java
+++ b/java/org/apache/coyote/Response.java
@@ -554,7 +554,14 @@ public final class Response {
 
         String charsetValue = m.getCharset();
 
-        if (charsetValue != null) {
+        if (charsetValue == null) {
+            // No charset and we know value is valid as parser was successful
+            // Pass-through user provided value in case user-agent is buggy and
+            // requires specific format
+            this.contentType = type;
+        } else {
+            // There is a charset so have to rebuild content-type without it
+            this.contentType = m.toStringNoCharset();
             charsetValue = charsetValue.trim();
             if (charsetValue.length() > 0) {
                 try {
diff --git a/test/org/apache/coyote/TestResponse.java b/test/org/apache/coyote/TestResponse.java
index 1ed01a7..f87e524 100644
--- a/test/org/apache/coyote/TestResponse.java
+++ b/test/org/apache/coyote/TestResponse.java
@@ -27,7 +27,6 @@ import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import org.apache.catalina.Context;
@@ -86,7 +85,6 @@ public class TestResponse extends TomcatBaseTest {
     }
 
 
-    @Ignore // Disabled until Bug 62912 is addressed
     @Test
     public void testContentTypeWithoutSpace() throws Exception {
         doTestContentTypeSpacing(false);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/03: Remove work-around for buggy Adobe Reader plug-in 9 on IE

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit d74a05d5100128f1b1715f700d715962b5a01b78
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Apr 3 19:21:40 2020 +0100

    Remove work-around for buggy Adobe Reader plug-in 9 on IE
---
 java/org/apache/tomcat/util/http/parser/MediaType.java | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/parser/MediaType.java b/java/org/apache/tomcat/util/http/parser/MediaType.java
index b4b84ae..2c548c0 100644
--- a/java/org/apache/tomcat/util/http/parser/MediaType.java
+++ b/java/org/apache/tomcat/util/http/parser/MediaType.java
@@ -78,10 +78,6 @@ public class MediaType {
                             continue;
                         }
                         result.append(';');
-                        // Workaround for Adobe Read 9 plug-in on IE bug
-                        // Can be removed after 26 June 2013 (EOL of Reader 9)
-                        // See BZ 53814
-                        result.append(' ');
                         result.append(entry.getKey());
                         result.append('=');
                         result.append(value);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 03/03: Update changelog

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a2a124ed1b161d9ad02222da67ea9219473a2f06
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Apr 3 19:23:52 2020 +0100

    Update changelog
---
 webapps/docs/changelog.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index dc8af5f..cb70a71 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -52,6 +52,11 @@
         <code>AprLifecycleListener</code> so that the only way to use the APR
         connectors is to set the full class name. (remm)
       </update>
+      <fix>
+        <bug>62912</bug>: Don't mutate an application provided content header if
+        it does not contain a charset. Also remove the outdated workaround for
+        the buggy Adobe Reader 9 plug-in for IE. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org