Recent

Author Topic: fastcgi test  (Read 3293 times)

Blestan

  • Sr. Member
  • ****
  • Posts: 461
fastcgi test
« on: April 08, 2017, 01:09:45 pm »
hi!
i m writing an api based on fastcgi behind lighttpd ( i will post later how to install lighttpd / ssl / fastcgi for fpc usage ... as the docs in this forum are for apache only)
but now i need an idea how to implement a very simple lazarus app to test the api ... the idea is to send request and display response in simple memo directly to/from the fastcgi daemon on dev machine ( as the real apps runs on a cloud machine behind lighttpd in production mode ) this will greatly reduce the dev/compile/deploy time for the api features.
i readed all the sources in fpweb and similar but didnt find any suitable code the send a httprequest warped in fastcgi protocol and then parse the response ...
any ideas?
p.s - many of you may say that fastcgi is pointless and i must go for reverse proxy but my opinion is that fastcgi i more clean solution because you avoid dealing with headers overriding and its more secure because its harder to connect to the backend directly with a simple browser
« Last Edit: April 08, 2017, 01:29:28 pm by Blestan »
Speak postscript or die!
Translate to pdf and live!

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: fastcgi test
« Reply #1 on: April 10, 2017, 04:50:26 am »
FastCGI is a server side protocol, what the clients request is still normal HTTP(S). Just use fphttpclient for that.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: fastcgi test
« Reply #2 on: April 10, 2017, 10:24:59 am »
i know very well that fastcgi i s a server/backend communication. what i want is a way to test the api backend w/o to have to deploy a full  http server on the dev machine ...
Speak postscript or die!
Translate to pdf and live!

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: fastcgi test
« Reply #3 on: April 11, 2017, 05:38:51 am »
i know very well that fastcgi i s a server/backend communication. what i want is a way to test the api backend w/o to have to deploy a full  http server on the dev machine ...
You're practically reinventing the wheel, feel free to take a look at mod_fcgid source code and convert it accordingly. Seriously, if you just want to test YOUR own code, then make a unit test instead, testing through FastCGI interface doesn't make sense unless you're testing the FastCGI implementation itself.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: fastcgi test
« Reply #4 on: April 11, 2017, 09:18:32 am »
you are right!
i dropped lighttp/fastcgi in favor of http server running api behind  haproxy.
now im working on the threading model and make the api generation swagger.io compatible to be able to generate js clients for mobile apps
Speak postscript or die!
Translate to pdf and live!

 

TinyPortal © 2005-2018