[REBOL] Fast-Cgi Test script
From: allenk::powerup::com::au at: 1-Jul-2001 22:20
----- Original Message -----
From: "Petr Krenzelok" <[petr--krenzelok--trz--cz]>
To: <[rebol-list--rebol--com]>
Cc: <[holger--rebol--com]>
Sent: Sunday, July 01, 2001 7:30 AM
Subject: [REBOL] possible solution to Command XServer font system ...
> Hi,
>
> today I was visited by my good friend Henry, who helped me to set-up my
SQL
> server under W2K and proved me I am using FastCGI in wrong manner (Windows
> Apache doesn't seem to keep my Rebol process persistent in CGI
compatibility
> mode ;-)
I thought the docs said that compatibility mode doesn't work on Windows. :-(
Here is a handy test script for FastCgi from Sterling.
>Save this file as fast-cgi.r and as fast-cgi.fcgi in your cgi-bin/
>dir. Fix the path at the top to point to your REBOL/command binary.
>Then just hit it with your web browser. If FastCGI is enabled and
>working properly then the FastCGI GET and POST should increment the
>counter wihle the other will not.
>Sterling
#!/usr/local/bin/rebol-cmd -c
REBOL[]
get-cgi-data: func
[
/local cgi-pars
]
[
cgi-pars: either system/options/cgi/request-method = "POST"
[
x: make string! 1000
data: make string! 1000
while [0 < read-io system/ports/input clear x 1000] [append data x]
data
]
[ system/options/cgi/query-string ]
if error? try [ return make object! decode-cgi cgi-pars ]
[
return none
]
]
if error? try [ counter: counter + 1 ]
[
counter: 1
]
print rejoin [ "Content-type: text/html"
newline ]
print rejoin [
"<html><head><title>Fast CGI Test</title></head>" newline
"<body>" newline
"<p>Our CGI data: " ]
probe get-cgi-data
print rejoin [
"</p>" newline
"<br/>Counter: " counter
" (this counter should increment for FastCGI)<br/>" newline
{<p><b>SlowCGI</b></p>} newline
{<p><form action="/cgi-bin/fast-cgi.r" method="post"> } newline
{<input type="hidden" name="aap" value="oink"/>}
{<input type="submit" name="ok" value="Post"/>}
{</form></p>}
{<p><form action="/cgi-bin/fast-cgi.r" method="get"> } newline
{<input type="hidden" name="aap" value="oink"/>}
{<input type="submit" name="ok" value="Get"/>}
{</form></p>}
{<p><b>FastCGI</b></p>} newline
{<p><form action="/cgi-bin/fast-cgi.fcgi" method="post"> } newline
{<input type="hidden" name="aap" value="oink"/>}
{<input type="submit" name="ok" value="Post"/>}
{</form></p>}
{<p><form action="/cgi-bin/fast-cgi.fcgi" method="get"> } newline
{<input type="hidden" name="aap" value="oink"/>}
{<input type="submit" name="ok" value="Get"/>}
{</form></p>}
"</body>" newline
"</html>" newline
]