ASF Bugzilla – Attachment 36389 Details for
Bug 62912
Tomcat adds a space character in the Content-Type header if this one has a ; character right after
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Tomcat 9 patch to retain app provided content-type
bug62912-tc9-v1.patch (text/plain), 2.46 KB, created by
Mark Thomas
on 2019-01-23 21:48:52 UTC
(
hide
)
Description:
Tomcat 9 patch to retain app provided content-type
Filename:
MIME Type:
Creator:
Mark Thomas
Created:
2019-01-23 21:48:52 UTC
Size:
2.46 KB
patch
obsolete
>Index: java/org/apache/catalina/connector/Response.java >=================================================================== >--- java/org/apache/catalina/connector/Response.java (revision 1851921) >+++ java/org/apache/catalina/connector/Response.java (working copy) >@@ -758,9 +758,17 @@ > 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 { >Index: java/org/apache/coyote/Response.java >=================================================================== >--- java/org/apache/coyote/Response.java (revision 1851921) >+++ java/org/apache/coyote/Response.java (working copy) >@@ -541,7 +541,14 @@ > > 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 { >Index: test/org/apache/coyote/TestResponse.java >=================================================================== >--- test/org/apache/coyote/TestResponse.java (revision 1851985) >+++ test/org/apache/coyote/TestResponse.java (working copy) >@@ -27,7 +27,6 @@ > import javax.servlet.http.HttpServletResponse; > > import org.junit.Assert; >-import org.junit.Ignore; > import org.junit.Test; > > import org.apache.catalina.Context; >@@ -87,7 +86,6 @@ > } > > >- @Ignore // Disabled until Bug 62912 is addressed > @Test > public void testContentTypeWithoutSpace() throws Exception { > doTestContentTypeSpacing(false);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62912
:
36262
| 36389