https://issues.apache.org/bugzilla/show_bug.cgi?id=53454

          Priority: P2
            Bug ID: 53454
          Assignee: dev@tomcat.apache.org
           Summary: Default doHead implementation overrides
                    'Content-Length' header
          Severity: normal
    Classification: Unclassified
          Reporter: n.s.skvort...@gmail.com
          Hardware: PC
            Status: NEW
           Version: 6.0.29
         Component: Servlet & JSP API
           Product: Tomcat 6

Created attachment 28985
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28985&action=edit
Sampe app with sources

If a client extends HttpServlet and desides to override doGet() method,
resulting servlet can fail to correctly handle HEAD requests.

This will happen, if client chooses to set Content-Length manually (e.g., to
allow content bigger than 2Gb):

  resp.setHeader("Content-Length", String.valueOf(12345678900L));

and only writes actual content if it is a GET request (e.g., because it is
costly operation).

In such conditions, GET request will have correct "Content-Length" header, but
HEAD requset will have "Content-Length" header with value 0. 

Sample project with sources is attached

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to