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/09/29 02:20:40 UTC

DO NOT REPLY [Bug 3882] New: - multiple identical headers

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=3882>.
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=3882

multiple identical headers

           Summary: multiple identical headers
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: jozart@csi.com


setContentLength() and setContentType() don't replace existing instances of
the "Content-Length" and "Content-Type" headers in the response's hash table.
This servlet demonstrates the problem: 

import javax.servlet.http.*;
 
public class HeaderBug extends HttpServlet {
    protected void doGet(HttpServletRequest request,
                         HttpServletResponse response) {
        response.setHeader("Content-Type", "text/html");
        response.setContentType("text/html");
        response.setIntHeader("Content-Length", 100);
        response.setContentLength(100);
    }
}

GET /servlet/HeaderBug HTTP/1.1

Tomcat/4.0 response:

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 100
Date: Sat, 29 Sep 2001 00:06:05 GMT
Server: Apache Tomcat/4.0 (HTTP/1.1 Connector)
Content-Type: text/html
Content-Length: 100

Tomcat/3.2.3 response:

HTTP/1.0 200 OK
Content-Type: text/html
Content-Length: 100
Servlet-Engine: Tomcat Web Server/3.2 (final) (JSP 1.1; Servlet 2.2; Java 1.3.1;
 Windows 2000 5.0 x86; java.vendor=Sun Microsystems Inc.)

Notice that there are two Content-Length and Content-Type headers in the
Tomcat/4.0 response.