* * *

Author Topic: Or does anybody have other HTTP Server example code in Lazarus/Freepascal?  (Read 1339 times)

pascalbythree

  • Jr. Member
  • **
  • Posts: 54
:-) Now working my hours on a lazarus CGI to see weither that can be a solution :-)

Blestan

  • Sr. Member
  • ****
  • Posts: 451
hi! im actulay developing api backend ... the idea is to have pascal http server behing ha-proxy terminating ssl and round robin loadbalance to many pascal servers ... servers are multithreded... 
interested? i will create a repo next few days ...
Speak postscript or die!
Translate to pdf and live!

Thaddy

  • Hero Member
  • *****
  • Posts: 4278
example:
Code: Pascal  [Select]
  1. program cgiexample;
  2. begin writeln(now);end.

Sorry, that's all I can find to make cgi simpler .... :( :( :(

« Last Edit: April 18, 2017, 09:55:43 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

BeniBela

  • Hero Member
  • *****
  • Posts: 563
    • homepage
example:
Code: Pascal  [Select]
  1. program cgiexample;
  2. begin writeln(now);end.

Sorry, that's all I can find to make cgi simpler .... :( :( :(

Can that work without a writeln('Content-Type: text/html'); writeln; first?

Leledumbo

  • Hero Member
  • *****
  • Posts: 7628
  • Programming + Glam Metal + Tae Kwon Do = Me
Can that work without a writeln('Content-Type: text/html'); writeln; first?
I don't think so, at least chrome expects it. No idea about other browsers (or what the standard mandates).

pascalbythree

  • Jr. Member
  • **
  • Posts: 54
Thaddy, where must i place the executable to run in de webserver? The test APP seems to pop-up with de file download.

PS Second Question: Does anybody have http component for Lazarus that can stuff strings with writeln or the classfarme work Message procedures. Instead of working with files.

Greets, Wouter
« Last Edit: April 19, 2017, 02:05:48 pm by pascalbythree »

Phil

  • Hero Member
  • *****
  • Posts: 2261
Thaddy, where must i place the executable to run in de webserver? The test APP seems to pop-up with de file download.

What server and OS are you using? With IIS, you need to enable the executable. See notes here for how to do that with an FCGI executable:

https://macpgmr.github.io/MacXPlatform/PascalDynLibs_4.html#Windows


pascalbythree

  • Jr. Member
  • **
  • Posts: 54
I am using a Raspberry Model 3 on Raspbian Jessie with PIXEL 2017-04-10

Anybody help on Linux? Howto execute the FPC application through the socket?


Preffered Lighttpd, otherwise Apache2 also will do fine.
« Last Edit: April 19, 2017, 06:09:05 pm by pascalbythree »

Leledumbo

  • Hero Member
  • *****
  • Posts: 7628
  • Programming + Glam Metal + Tae Kwon Do = Me
I am using a Raspberry Model 3 on Raspbian Jessie with PIXEL 2017-04-10

Anybody help on Linux? Howto execute the FPC application through the socket?


Preffered Lighttpd, otherwise Apache2 also will do fine.
No idea about lighttpd, but apache should have cgi support built-in. Just put it wherever your apache config accepts cgi executables (read its documentation if you have no idea).

Phil

  • Hero Member
  • *****
  • Posts: 2261
Just put it wherever your apache config accepts cgi executables (read its documentation if you have no idea).

Somewhere like /var/www/html

And make sure Apache is running, for example:

sudo service apache2 restart

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus