-
Bug
-
Resolution: Done
-
Major
-
3.0.16.Final
-
None
Per HTTP spec, responses to HEAD requests should include Content-Length header indicating the entity size even though the entity itself is not included in response. Generic javax.servlet.http.HttpServlet.doHead() supports this as well.
However, RESTEasy skips the entity serialization for HEAD requests and thus returns the wrong Content-Length: 0. In org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse():
if (jaxrsResponse.getEntity() == null || request.getHttpMethod().equalsIgnoreCase("HEAD")) { response.setStatus(jaxrsResponse.getStatus()); commitHeaders(jaxrsResponse, response); return; }
Note this happens after the resource method already built the response, so all we're saving here is serialization – the heavy lifting of building the response already occurred.
- causes
-
RESTEASY-1627 Automatic HEAD requests breaks subsequent request(s) on resteasy-netty4 and resteasy-vertx
- Resolved
- is cloned by
-
JBEAP-4671 (7.1.0) HEAD requests always return Content-Length: 0
- Verified
- is incorporated by
-
JBEAP-5447 (7.0.z) RESTEASY-1365 - HEAD requests always return Content-Length: 0
- Verified
- relates to
-
RESTEASY-1632 Improve header processing in response to HEAD requests
- Open