[fpc-devel] fpweb is not showing the exception message

ABorka fpc-devel at aborka.com
Tue Apr 12 08:26:07 CEST 2011


I was playing today with fpweb a little, and found a simply reproducible 
minor problem.

When one creates a new CGI or FCGI application and creates a simple 
default action, but NOT setting the "handled := true;" within the event 
handler, then some kind of exception happens within fpweb when the 
action is called from the client browser, but it does not return a full 
response error message page.
All that comes back to the client is:

"<html><head><title>APPNAME: "

where the APPNAME is the title for the application. This happens at 
least for CGI and FCGI applications, not sure about Apache modules as I 
did not try that.
As soon, as we have "handled := true;" there, everything is OK.
If we have "handled := false;" or simply not setting it, the above issue 
happens. It seems, that there is a problem with displaying error 
messages/exceptions from within fpweb internals.

/Latest FPC and Lazarus SVN, WinXP 32bit/

===============
Example:

procedure TFPWebModule1.DefActionRequest(Sender: TObject; ARequest: 
TRequest; AResponse: TResponse; var Handled: Boolean);
begin
   Handled := true; //<-- if removed, the response is always the above
//and no matter what follows below
   AResponse.Content := '<html><body>Yo! (F)CGI works!</body></html>';
end;
===============

AB




More information about the fpc-devel mailing list