You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/03/16 00:06:19 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/http ContentType.java

larryi      01/03/15 15:06:19

  Modified:    src/share/org/apache/tomcat/util/http ContentType.java
  Log:
  Port fix from tomcat_32 by Marc Saegesser.
  
  Strip any double-quote characters from around the charset value
  in the Content-type header.
  
  Coincidentally, there was a recent thread on the HTTP WG mailing
  list about this topic and the conclusion was that that specification
  does support enclosing the value of the charset attribute in quotes
  (although I'm at a loss as to why anyone would want to).
  
  Reported by Rick Rupp (rick.rupp@merant.com).
  
  PR: 650/ Buzzilla 364
  
  Revision  Changes    Path
  1.4       +4 -0      jakarta-tomcat/src/share/org/apache/tomcat/util/http/ContentType.java
  
  Index: ContentType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/ContentType.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContentType.java	2001/02/20 03:14:11	1.3
  +++ ContentType.java	2001/03/15 23:06:18	1.4
  @@ -90,6 +90,10 @@
               return null;
           }
           String afterCharset = type.substring(charsetLocation + 8);
  +        // The charset value in a Content-Type header is allowed to be quoted
  +        // and charset values can't contain quotes.  Just convert any quote
  +        // chars into spaces and let trim clean things up.
  +        afterCharset = afterCharset.replace('"', ' ');
           String encoding = afterCharset.trim();
           return encoding;
       }