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
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: [EMAIL PROTECTED]
http://www.po-net.prato.it

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

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to