Recent

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

pascalbythree

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

Blestan

  • Sr. Member
  • ****
  • Posts: 461
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: 14159
  • Probably until I exterminate Putin.
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 »
Specialize a type, not a var.

BeniBela

  • Hero Member
  • *****
  • Posts: 905
    • 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: 8744
  • 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

  • Sr. Member
  • ****
  • Posts: 255
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: 2737
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

  • Sr. Member
  • ****
  • Posts: 255
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: 8744
  • 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: 2737
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

 

TinyPortal © 2005-2018