Not entirely correct.
Using the "AddHandler" directive means that you only ever create a single handler script. After this, whenever a file with a ".kix" extension is referenced, the handler is called. You don't need to worry about anything other than the KiXtart script file - it will be executed automatically.
The syntax of the handler (kix_exec.bat) can be simplified to:
code:
@kix32.exe "%PATH_TRANSLATED%"
@If Not Exist %TEMP%\%REMOTE_ADDR%_%REMOTE_PORT%.txt Exit /B 0
@type %TEMP%\%REMOTE_ADDR%_%REMOTE_PORT%.txt
@del %TEMP%\%REMOTE_ADDR%_%REMOTE_PORT%.txt
Using the REMOTE* environment variables ensures that the temporary file will be unique for every request.
You KiXtart script just needs these two lines at the start:
code:
$gNULL=SetOption("ASCII","ON")
$gNULL=RedirectOutput(%TEMP%+"\"+%REMOTE_ADDR%+"_"+%REMOTE_PORT%+".txt",1)
The sample script:
code:
$gNULL=SetOption("ASCII","ON")
$gNULL=RedirectOutput(%TEMP%+"\"+%REMOTE_ADDR%+"_"+%REMOTE_PORT%+".txt",1)
"Content-Type: text/html" ?
?
"<HTML>" ?
"<HEAD>" ?
"<TITLE>KiXtart as CGI demonstration</TITLE>"
"</HEAD>" ?
"<BODY>" ?
"Using KiXtart version "+@KIX+" as CGI!" ?
"</BODY>" ?
"</HTML>" ?
Produces:
I tested this with 3.60, and it still needs the redirect.
I also tried to force the output to stdout using "> con", but this just gave an "Access is denied" error, presumably because there is no console.