https://bz.apache.org/bugzilla/show_bug.cgi?id=69469

            Bug ID: 69469
           Summary: Servlets can not set certain headers in responses to
                    HEAD requests
           Product: Tomcat 10
           Version: 10.1.33
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: pawel.vese...@gmail.com
  Target Milestone: ------

Caused by changes for https://bz.apache.org/bugzilla/show_bug.cgi?id=69379.

The change forces certain headers out of the responses:

headers.remove("content-length");
headers.remove("content-range");
headers.remove("trailer");
headers.remove("transfer-encoding");

So, even if a servlet wants to set the "content-length" header (others are
probably never useful for a HEAD response), the set header doesn't show up in
the response.

Note that the FIX notes for 69379 are:

<fix>
  <bug>69379</bug>: The default HEAD response no longer includes the
  payload HTTP header fields as per section 9.3.2 of RFC 9110. (markt)
</fix>

However, the result of the fix is that even the non-default HEAD response can't
have those headers.

To reproduce, have a servlet class that overrides `doHead()`, and call
response.setHeader("Content-length", String.valueOf(contentLength));

-- 
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