[fpc-pascal] CGI with datamodule does not work
Sven Barth
pascaldragon at googlemail.com
Wed Feb 27 07:28:44 CET 2019
Am 27.02.2019 um 01:42 schrieb AB:
> Hi Guys,
>
> I have tried to update my old web project that is in maintenance mode
> since a few years now, using the latest stable Lazarus/FPC, and
> fcl-web just does not want to work (Tried Lazarus 1.8.4/FPC 3.0.4,
> Lazarus 2.0.0/FPC 3.0.4 with Apache 2.4, on Linux x86_64, though the
> OS should not matter with fcl-web).
>
> So, after I could not make my original project work with the newer
> fcl-web, I have created a basic Lazarus project: File -> New -> CGI
> Application, and added a default action that just returns a simple
> html page:
>
> procedure Tblahblah.WebDefaultActionRequest(Sender: TObject;
> ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);
> begin
> Handled := true;
> AResponse.Content := '<html><body>This function is not implemented
> yet. ' + DateTimeToStr(Now) + '</body></html>';
> end;
>
> This one did not work either. Tried in docker with apache-alpine,
> docker with apache, heck, even put it on my live Ubuntu 16.04 with
> Apache web server at the end, with the same result, an error HTML page
> from the CGI application:
> "The application encountered the following error:
>
> Error: Not found
> Stack trace:
> $0000000000499B40
> $00000000004990EF"
>
> Did anyone test this fcl-web part lately?
>
> BTW, A simple CGI application works OK (File -> New -> Custom CGI
> Application), though there are no Actions, of course:
>
> Procedure TMyCGIHandler.HandleRequest(ARequest : Trequest; AResponse :
> TResponse);
>
> begin
> // Your code here
> AResponse.Content := '<html>Something. (' + ARequest.QueryString +
> ')</html>';
> end;
>
>
> Any reproduction or help is appreciated.
Just a guess: does adding "Application.LegacyRouting := True;" in the
main source file fix the problem?
If so then you should read up on the differences between the old, legacy
routing and the newer more flexible one here:
http://wiki.lazarus.freepascal.org/fpWeb_Tutorial#Routing
Regards,
Sven
More information about the fpc-pascal
mailing list