CGI with datamodule does not work

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CGI with datamodule does not work

ABorka
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.

AB
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: CGI with datamodule does not work

Free Pascal - General mailing list
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: CGI with datamodule does not work

Michael Van Canneyt
In reply to this post by ABorka


On Tue, 26 Feb 2019, AB wrote:

> 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).
>

[snip]

> Did anyone test this fcl-web part lately?

Yes, yesterday only. I added a new web module type...

> BTW, A simple CGI application works OK (File -> New -> Custom CGI
> Application), though there are no Actions, of course:
>
> Any reproduction or help is appreciated.

As Sven recommended, please check the LegacyRouting and new routing
mechanism.
http://wiki.lazarus.freepascal.org/fpWeb_Tutorial#Routing
with legacyrouting the 'old' code is executed when determining the module.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: CGI with datamodule does not work

ABorka
Indeed, this has fixed it.  Thank you guys.


AB

On 2/27/19 12:16 AM, Michael Van Canneyt wrote:

>
>
> On Tue, 26 Feb 2019, AB wrote:
>
>> 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).
>>
>
> [snip]
>
>> Did anyone test this fcl-web part lately?
>
> Yes, yesterday only. I added a new web module type...
>
>> BTW, A simple CGI application works OK (File -> New -> Custom CGI
>> Application), though there are no Actions, of course:
>>
>> Any reproduction or help is appreciated.
>
> As Sven recommended, please check the LegacyRouting and new routing
> mechanism.
> http://wiki.lazarus.freepascal.org/fpWeb_Tutorial#Routing
> with legacyrouting the 'old' code is executed when determining the module.
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal