Re: Question about Content-Length

> 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
least,
    not all the servers put it in all the cases).

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

    So, if what you need is know the content length of an object in advance,
I'm
    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
anyway,
    either with the HTTP header value or with the number of bytes read.

-- Raffaele

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