[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 Mark Thomaschanged: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #8 from Mark Thomas --- This has been fixed so Tomcat will not send a Content-Length header for a HEAD request unless the application explicitly specifies one. The fix has been made in: - 9.0.x for 9.0.0.M5 - 8.5.x for 8.5.1 - 8.0.x for 8.0.34 - 7.0.x for 7.0.70 - 6.0.x for 6.0.46 -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 --- Comment #7 from Mark Thomas--- That won't work. The OutputBuffer will still set the content length to zero. resp.flushBuffer(); sort of works but adds the Transfer-Encoding header. I'm currently experimenting with a unit test to see if I can find a better solution although using flushBuffer() is likely to be the best cross-container solution. -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 --- Comment #6 from Konstantin Kolinko--- You should be able to do the following in your servlet: protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentLength(-1); } (BTW, skipping a setContentLength() call in javax.servlet.http.HttpServlet will have the same effect. The contentLength is a numeric field that always has some value, with -1 being the default. The actual header is generated in o.a.coyote.http11.Http11Processor.prepareResponse()). -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 Tobias Oberlieschanged: What|Removed |Added Status|NEEDINFO|NEW --- Comment #5 from Tobias Oberlies --- (In reply to Violeta Georgieva from comment #4) > If I have a servlet like this: My servlet has a different doGet method: Mine returns a response with unknown length. doHead is basically the same - but that results in an incorrect response: the response to the HEAD request includes a generated "Content-Length: 0". AFAIK, there is no reasonable way to make Tomcat not generate this header. (In reply to Christopher Schultz from comment #3) > Would you mind testing quickly with 8.0.33? I've tried with 8.0.33, and the result is the same: > HEAD /test-backend/raw/foo HTTP/1.1 > User-Agent: curl/7.29.0 > Host: localhost:8080 > Accept: */* > < HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < Content-Length: 0 < Date: Mon, 18 Apr 2016 10:59:20 GMT -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 Violeta Georgievachanged: What|Removed |Added Status|NEW |NEEDINFO -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 --- Comment #4 from Violeta Georgieva--- Hi, If I have a servlet like this: public class TestServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter(); } protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter(); } } Both GET and HEAD requests return "Content-Length: 0". So the size of the HEAD corresponds to the size of the GET. Do you observe something else? Regards, Violeta -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 --- Comment #3 from Christopher Schultz--- Would you mind testing quickly with 8.0.33? -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 Tobias Oberlieschanged: What|Removed |Added Status|NEEDINFO|NEW --- Comment #2 from Tobias Oberlies --- (In reply to Christopher Schultz from comment #1) > So a servlet like this will cause Tomcat to return "Content-Length: 0"? Yes, exactly. The same happens without the close() call. -- 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
[Bug 59310] Content-Length of HEAD requests incorrectly computed as
https://bz.apache.org/bugzilla/show_bug.cgi?id=59310 Christopher Schultzchanged: What|Removed |Added Status|NEW |NEEDINFO --- Comment #1 from Christopher Schultz --- So a servlet like this will cause Tomcat to return "Content-Length: 0"? public class TestServlet extends HttpServlet { public void doHead(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.getWriter().close(); } } -- 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