[fpc-pascal] ContentData field size in FCGI_ContentRecord of fastcgi unit

Michael Van Canneyt michael at freepascal.org
Sat May 18 10:53:44 CEST 2019

On Sat, 18 May 2019, Zamrony P. Juhara via fpc-pascal wrote:

>> From fastcgi.pp
> https://github.com/graemeg/freepascal/blob/master/packages/fastcgi/src/fastcgi.pp
> In line 510
> FCGI_ContentRecord = record
>     header : FCGI_Header;
>     ContentData : array[0..1023] of byte;
> end;
> Field ContentData is 1024 bytes. Actual ContentData length is related to field ContentLength of FCGI_Header. ContentLength is declared as word type to conform with FastCGI specification. So maximum ContentLength is 65536 bytes.
> According  to FastCGI specification,
> http://www.mit.edu/~yandros/doc/specs/fcgi-spec.html
> "contentData: Between 0 and 65535 bytes of data, interpreted according to the record type."
> Why fastcgi.pp declared it as array[0..1023] of byte instead of array[0.. 65535] of byte ?

This unit is a translation of a library. Most likely, that was exactly the
value specified in the original header files.

I would not recommend using this unit. 
It is most likely outdated, and I would not even know what library it supports. 
I will ask on the core group what to do, I think it is better to remove it.

Free Pascal supports fastcgi natively using the custfcgi or fpfcgi units.


More information about the fpc-pascal mailing list