[htdig3-dev] Transfer-Encoding [Send Again]


Subject: [htdig3-dev] Transfer-Encoding [Send Again]
From: Gabriele Bartolini (g.bartolini@comune.prato.it)
Date: Wed Feb 09 2000 - 03:04:57 PST


On September 29th 1999, I wrote to the list this message about
chunked-bodies.

As far as I'm concerned, I think that no Content-Length header is sent if
the Transfer-Encoding is set to chunk.

Ciao
-Gabriele

=========================
Original message
=========================

Probably I understood why it goes this way ...

When we make a HTTP/1.1 request, and we receive 302, for example, we have
no Content-Length set but we have the Transfer-Encoding set to 'chunked'.
Here is the problem: decoding the chunked-body.

RFC2616 (HTTP/1.1) explains the 'Chunked-body' this way:

------------

       Chunked-Body = *chunk
                        last-chunk
                        trailer

                        CRLF

       chunk = chunk-size [ chunk-extension ] CRLF
                        chunk-data CRLF
       chunk-size = 1*HEX
       last-chunk = 1*("0") [ chunk-extension ] CRLF

       chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
       chunk-ext-name = token
       chunk-ext-val = token | quoted-string
       chunk-data = chunk-size(OCTET)
       trailer = *(entity-header CRLF)

------------

It also suggests to decode the 'chunked' transfer-coding this way (it
proposed a pseudo-code):

------------

       length := 0
       read chunk-size, chunk-extension (if any) and CRLF
       while (chunk-size > 0) {
          read chunk-data and CRLF
          append chunk-data to entity-body
          length := length + chunk-size
          read chunk-size and CRLF
       }
       read entity-header
       while (entity-header not empty) {
          append entity-header to existing header fields
          read entity-header
       }
       Content-Length := length
       Remove "chunked" from Transfer-Encoding

------------

I'll try to write down the code ... and hope it works ...

Ciao
-Gabriele

-------------------------------------------------

Gabriele Bartolini
Computer Programmer (are U sure?)
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: g.bartol@comune.prato.it
http://www.po-net.prato.it

"Life teaches you never stop learning ..."

-------------------------------------------------

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
htdig3-dev-unsubscribe@htdig.org
You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Wed Feb 09 2000 - 03:08:23 PST