You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Karl Moss <km...@allaire.com> on 2000/10/10 16:25:44 UTC

doHead() not setting Content-Length properly

I'm running into a problem when using doHead() where the Content-Length is
not being set properly. Per the HTTP 1.0 RFC:

10.4  Content-Length

   The Content-Length entity-header field indicates the size of the
   Entity-Body, in decimal number of octets, sent to the recipient or,
   in the case of the HEAD method, the size of the Entity-Body that
   would have been sent had the request been a GET.

Performing a HEAD operation will return 0 for the Content-Length unless the
requested servlet explicitly performs a flush of the output stream. Seems to
me that HttpServlet.doHead() should flush the output stream for you before
setting the content length on the response.

Thanks,

Karl.