Change to Chunk Length Syntax

  In Memphis, we discussed allowing leading zeros in the
  specification of a chunk length.

  For the benefit of those who were not there, and to more fully
  explain the reason for this change:

  Our server implementation is for embedded systems:

    - Usually the response to any request will consist partly
      of dynamically generated content whose length cannot be known
      before it is generated (hence the use of chunked encoding).

    - Embedded systems generally have less flexible buffering schemes
      (no scatter-gather buffers, for example).

  We must therefor leave room for the length in a buffer and then
  fill it when the dynamic content is complete; note that this space
  does not necessarily fall at the beginning of the buffer.

  Since we can't even know how many digits the length will require, it
  is convenient to be allowed to use leading zeros to consume any
  unused digits (a more complex workaround is available without this
  change, but it requires more bytes and is unsightly).

  I propose that the syntax description of chunked encoding be changed
  to:
  ================================================================

       Chunked-Body   = *chunk
                        last-chunk
                        footer
                        CRLF

       chunk          = chunk-size [ chunk-ext ] CRLF
                        chunk-data CRLF

       chunk-size     = 1*HEX

       last-chunk     = 1*("0") [ chunk-ext ] CRLF

       chunk-ext      = *( ";" chunk-ext-name [ "=" chunk-ext-value ] )
       chunk-ext-name = token
       chunk-ext-val  = token | quoted-string
       chunk-data     = chunk-size(OCTET)

       footer         = *entity-header

  The chunked encoding is ended by any chunk whose size is zero,
  followed by the footer, which is terminated by an empty line.

  ================================================================

  This modified syntax also allows a chunk-ext on the last chunk,
  which I added just for symmetry, and for the length of the final
  chunk to be multiple digits as long as they are all zero.

--
Scott Lawrence                                       <lawrence@agranat.com>
Agranat Systems, Inc.                               http://www.agranat.com/

Received on Friday, 11 April 1997 06:21:10 UTC