Length Incosistency Between FCGI_RECORD and FCGI_PARAMS

Volkan YAZICI <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi,

AFAIU, FCGI_PARAMS are wrapped in FCGI_RECORD data types. (Please
correct me if I am wrong.) And there are four types of FCGI_PARAMS
message formats with variable length headers:

  1. {KEY-LEN[1], VAL-LEN[1], KEY[KEY-LEN], VAL[VAL-LEN]}
  2. {KEY-LEN[1], VAL-LEN[4], KEY[KEY-LEN], VAL[VAL-LEN]}
  3. {KEY-LEN[4], VAL-LEN[1], KEY[KEY-LEN], VAL[VAL-LEN]}
  4. {KEY-LEN[4], VAL-LEN[4], KEY[KEY-LEN], VAL[VAL-LEN]}

But an FCGI_RECORD message header format is of fixed length. Now
consider below message:

  {VERSION    [1],
   TYPE[1],                  // FCGI_PARAMS Type
   REQUEST-ID [2],
   CONTENT-LEN[2],
   PADDING-LEN[1],
   RESERVED   [1],
   CONTENT    [CONTENT-LEN], // {KEY-LEN[4],
                             //  VAL-LEN[4],
                             //  KEY    [KEY-LEN],
                             //  VAL    [VAL-LEN]}
   PADDING    [PADDING-LEN]}

Whole record length is represented by 2 bytes (maximum 2^(2*8) bytes),
but a key+value length might be representing a block of 8 bytes (maximum
2^(4*8) bytes) in size.

  +-----------------------------+
  | ### FCGI_RECORD ########### |
  | +----------------------------------------------+
  | | ### FCGI_PARAMS ############################ |
  | +----------------------------------------------+
  +-----------------------------+

  ^                             ^                  ^
  |---- 2^(2*8)=65536 bytes ----|                  |
  |--------------- 2^(4*8)=4294967296 -------------|

How can this be possible? I have read FastCGI specification[1] over and
over again but couldn't find a clue. Would you mind helping me to
clarify this point please?


Regards.

[1] http://www.fastcgi.com/devkit/doc/fcgi-spec.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.