W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1999

Re: Question about Content-Length

From: Raffaele Sena <raff@nuvomedia.com>
Date: Tue, 23 Nov 1999 22:33:52 -0800
Message-ID: <00f001bf3645$e093f720$353728ce@aromatic.com>
To: "John Punin" <puninj@cs.rpi.edu>, <www-lib@w3.org>
Cc: <puninj@cs.rpi.edu>

> Hi
> I hope that someone can help me with this matter. If I execute the
> program "chunk" of the examples of the Library in this way:
> Content-Length: 14187
> Accept-Ranges: bytes
> Connection: close
> Content-Type: text/html
> When I execute:
>     ...
> HTTP/1.1 200 OK
> Server: Microsoft-IIS/4.0
> Date: Wed, 24 Nov 1999 06:04:39 GMT
> Connection: close
> Content-type: text/html
> As you see the information of Content-Length is missing. How can I get
> it using the Library?.
    Well, Content-Length is not a mandatory field in the HTTP header (or at
    not all the servers put it in all the cases).

    For example, in case of a page generated automatically (i.e. from a CGI
    the script itself may not know the page length until it's done, and so it
    doesn't put it.

    So, if what you need is know the content length of an object in advance,
    afraid but that cannot be done.

    If what you need is getting the length after the object has been read, I
    believe the Response (or Request ?) object will have the field filled
    either with the HTTP header value or with the number of bytes read.

-- Raffaele
Received on Wednesday, 24 November 1999 01:37:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC