Board index » delphi » Converting TIdHTTPRequestInfo to params for TCGIRequest

Converting TIdHTTPRequestInfo to params for TCGIRequest


2004-02-09 12:14:49 PM
delphi45
I'm running an Indy HTTP server and would like to run standard CGI apps
(exe's will do for now). I am already running console apps and returning
their output but for a proper cgi interface I (think I) need to set
environment variables first. I have started doing:
SetEnvironmentVariable('REQUEST_METHOD', PChar(RequestInfo.Command));
SetEnvironmentVariable('SERVER_PROTOCOL',
PChar(RequestInfo.ContentVersion));
But not all cgi fields have Indy equivalents - like PATH_INFO - also,
HTTP_AUTHORIZATION matching seems complicated.
Just wondering if anyone has ever done this before (but if past experience
is anything to go by nobody is using Indy as a web server - not even the
Indy site).
 
 

Re:Converting TIdHTTPRequestInfo to params for TCGIRequest

"Reiner" <XXXX@XXXXX.COM>writes
Quote
I am already running console apps and returning their output
That is the correct way to handle it.
Quote
but for a proper cgi interface I (think I) need to set environment
variables first.
Use CreateProcess() when running the console programs. It has an
lpEnvironment parameter that you can specify your own environment values
with for the new process. Do not use SetEnvironmentVariable() for this, it
alters the environment of the calling process, in this case your server
itself. Each cgi process should have its own unique environment.
Quote
But not all cgi fields have Indy equivalents - like PATH_INFO
That would be the request's Document property.
Gambit