[Lazarus] fp-Web and FastCGI

ABorka fpc-devel at aborka.com
Sun Oct 10 20:59:56 CEST 2010


On 10/10/2010 11:51, Michael Van Canneyt wrote:
>
>
> On Sun, 10 Oct 2010, Leonardo M. Ramé wrote:
>
>> On 2010-10-10 13:34:30 -0300, Leonardo M. Ramé wrote:
>>>
>>> exception at 0000000000466EEA:
>>> Failed to open input-handle passed from server. Socket Error: 88.
>>>
>>> Now I'm stuck, somebody can help me with this?.
>>>
>>
>> I figured out that I was configuring wrongly my apache2. Instead of
>> using FastCgiExternalServer I changed it for this:
>>
>>
>> FastCgiServer /var/www/fcgi-bin/myfastcgiapp.fcgi -idle-timeout 3
>>
>> Also, I was using a symbolic link to
>> /var/www/fcgi-bin/myfastcgiapp.fcgi, and now I just copied my app to
>> that directory.
>>
>> Then, I restarted apache2, and went to
>> http://localhost/fcgi-bin/myfastcgiapp.fcgi and, got a *more friendly*
>> response.
>>
>> I removed my TFPWebModule actions, and added just this global request
>> handler:
>>
>> procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest:
>> TRequest;
>> AResponse: TResponse; var Handled: Boolean);
>> begin
>> AResponse.Content := 'Hello World!';
>
> You're missing
>
> AResponse.SendResponse;
>
> Handled is supposed to be set only after the response has been sent.
>
> CGI additionally checks if content was sent, but fastcgi not.
> Maybe we should add this check to FastCGI.
>
> Michael.

Yes, please :) it would be super.
We should not have that ".SendResponse" line at all in our event 
handlers, just like with CGI and Apache modules with fpweb.

Handled := true; should only be checked after the event handler 
finished, as an indicator that the request was handled and the response 
was generated and can be found in the ".Content" .
What is the purpose of the Handled parameter if not this with 
cgi/fcgi/apache_module?

AB





More information about the Lazarus mailing list