Re: HTTP Content-length question...

Robert S. Thau (rst@ai.mit.edu)
Mon, 8 May 1995 10:49:39 +0500


From: Srivatsa Srinivasan <srinivas@cs.iastate.edu>

Hello WWWorld,

I have a HTTP protocol question.

I have a simple HTTP client that requests an object from a HTTP
server using the GET method. Now, the client is written such that
it mandatorily needs the server to return the 'Content-length:'
header in its response.

The problem I am facing is, this header is returned for most kind
of objects (image/gif, audio/au etc) but not for text/html. Is
there any special form of the GET request that will force the
server to return the size of the object (the 'Content-length:'
header) irrespective of its MIME type ?

As some people have mentioned, the answer is no --- the server doesn't
know the content-length of dynamically generated objects (i.e., those
resulting from processing of server-side includes or invocation of a
CGI script), so it *can't* report content-length for those items. If
the server is NCSA-type, and the webmaster has declared all *.html
files to be server-side-included, the effect will be as you report ---
no HTML files will have content-length reported.

(In principle, the server could do a prepass over the file to see if
any inclusion directives are present, and report content-length if
there aren't any; in practice, it doesn't).

rst