You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/11/06 13:20:32 UTC

DO NOT REPLY [Bug 4674] New: - SSI-Servlet produces invalid character encoding information

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4674>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4674

SSI-Servlet produces invalid character encoding information

           Summary: SSI-Servlet produces invalid character encoding
                    information
           Product: Tomcat 4
           Version: Nightly Build
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: rami.hanninen@davisor.com


I have resently reported a number of SSI-Servlet bugs. Happily, they have all
been quickly fixed, but unfortunately at the same time at least one new bug has
sneaked into the code.

This new bug appears in the latest nighly builds only, and it makes the
SSI-Servlet to produce invalid character encoding headers. In particular, the
'Content-Encoding' header SSI-Servlet generates has always the value 'UTF-8'.
This is wrong! Instead, the encoding should be taken from server MIME type
mapping table, defined in Tomcat 'server.xml' configuration file.

Here is the faulty source code, and a proposed fix (thanks to my colleague Mikko
Kurkisuonio for providing it):

in requestHandler() method:
        // Get the SsiEnvironment instance for this request.
        ssiEnv = SsiEnvironment.createSsiEnvironment(servletContext,
                                                      req, res, path);
        ssiEnv.setIsVirtualWebappRelative(isVirtualWebappRelative);

        res.setContentType("text/html;charset=UTF-8");
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The countent type should probably be resolved like with the DefaultServlet:

        // Find content type.
        String contentType =
            getServletContext().getMimeType(resourceInfo.path);

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>