Re: [Q] Content length in MIME headers always right?

Sacha writes:

> I have a question regarding content length. Sometimes when
> I just fetch the header of a document I get a content length
> of -1 (i.e. unset), but if I get the entire document I get
> the correct content length. Can it be that the server creates
> different headers depending on whether you also ask for the
> document? Does this mean that the only way to get the content
> length with absolute certainty is to request the whole document?
> Could it be that this -1 has something to do with access
> restrictions?

Hi Sacha,

Do you have any examples of this? I could imagine that some servers may not 
send the content length on a HEAD request if the output is produced 
dynamically (for example a script or a server side include). However, the 
HTTP spec states explicitly that it is not allowed to distinguish the two 
situations - there must always be a valid content length (or some other 
means of determining the size of the response).

Henrik Frystyk Nielsen, <frystyk@w3.org>
World Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA

Follow-Ups: References: