[fpc-pascal] How to use FCGI in threaded mode?

silvioprog silvioprog at gmail.com
Sun Feb 15 20:53:57 CET 2015


On Sun, Feb 15, 2015 at 7:11 AM, Michael Van Canneyt <michael at freepascal.org
> wrote:
[...]

> Very nice.
>
> Some remarks:
>
> - KeepConnection logic already existed. It is part of the fastcgi protocol.
>
>   Normally, the apache server must send a keepconnection option as part of
> the request.
>   See the 'FKeepConnectionAfterRequest' variable in TFCGIrequest, it is
> processed when
>   the FCGI_BEGIN_REQUEST block comes in and is checked after each request.
>
>   The fact that you apparently needed to introduce special processing
> means the proxy
>   module does not correctly set this option. To test, you can check the
> value of the flag
>   in the request handler.
>
>   I also suggest you look at the existing implementation of KeepConnection
> and see
>   where that needs to be changed, instead of introducing new
> KeepConnection handling.
>

I saw, and it works fine in nginx, but ...

- if you really need to introduce  an additional flag, please put an extra
> flag in
>   ProtocolOptions. Something like 'poDefaultKeepConnection'.
>   Do not introduce new booleans 'options' when an option set exists...
>

... in Apache, using proxy mode, keepconn always returns true. =/ So we
need to add a 'poProxyKeepConnection' flag.


> - Don't change the constructor signature, that is bad practice.
>
>   A TComponent constructor must be Create(AOwner : TComponent);
>
>   if you really want to change it, just create another one:
>   Constructur CreateCustom(AOwner : TComponent; KeepConnection : Boolean);
>
>   For components, properties must always be settable after create,
>   otherwise streaming does not work correctly.


Done. Please see the code in attached (some changes in mycustfcgi too).

After your tips, now I'm able to implement the changes in original custfcgi
and send a patch. One more question before continuing: after implementing
the pool, we will still need RequestsArray?

PS. please see a initial patch http://bugs.freepascal.org/view.php?id=27463.

-- 
Silvio Cl├ęcio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150215/dc51a76d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FastCGI_Proxy_nginx_Apache24_III.zip
Type: application/zip
Size: 10880 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150215/dc51a76d/attachment.zip>


More information about the fpc-pascal mailing list