luehe       2004/07/27 17:43:07

  Modified:    catalina/src/share/org/apache/catalina/connector
                        Response.java
  Log:
  Fixed Bugtraq 6152759 ("Default charset not included in Content-Type
  response header if no char encoding was specified").
  
  According to the Servlet 2.4 spec, calling:
  
    ServletResponse.setContentType("text/html");
  
  must yield these results:
  
    ServletResponse.getContentType() -> "text/html"
  
    Content-Type response header -> "text/html;charset=ISO-8859-1"
  
  Notice the absence of a charset in the result of getContentType(), but
  its presence (set to the default ISO-8859-1) in the Content-Type
  response header.
  
  Tomcat is currently not including the default charset in the
  Content-Type response header if no char encoding was specified.
  
  Revision  Changes    Path
  1.4       +17 -1     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Response.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Response.java     23 Jul 2004 22:38:29 -0000      1.3
  +++ Response.java     28 Jul 2004 00:43:07 -0000      1.4
  @@ -497,6 +497,22 @@
   
   
       /**
  +     * Returns the value of the Content-Type response header, based on the
  +     * current return value of getContentType().
  +     *
  +     * Notice that while the charset parameter must be omitted from the
  +     * return value of ServletResponse.getContentType() if no character
  +     * encoding has been specified, the spec requires that a charset (default:
  +     * ISO-8859-1) always be included in the Content-Type response header
  +     *
  +     * @return Value of Content-Type response header
  +     */
  +    public String getContentTypeResponseHeader() {
  +        return (coyoteResponse.getContentTypeResponseHeader());
  +    }
  +
  +
  +    /**
        * Return a PrintWriter that can be used to render error messages,
        * regardless of whether a stream or writer has already been acquired.
        *
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to