[Xitami] running cgi on xitami problem
Marc Doigny
xitami@lists.xitami.org
Mon, 09 May 2005 08:34:14 +0200
At 05:04 7/05/05, you wrote:
>Hello All,
>
>
>I like to run xitami as a service while I don't have to log onto the machine
>( power outage...power back on = xitami back on).
>Has anyone running xitami as a service with xigui32 and srvany ? Haven't
>tried it yet.
>
>Johannes
I don't have any problem running gap.
My system is win 2k, running v2.4d9
and win 98 running v2.4d6
For those interested in solving the problem, here is the source code of the
gap utility:
(PBCC, looks like visual basic without GUI)
Most problems with running cgi applications were caused by incorrect home
directory (assuming a running directory), but this is not the case here,
there is no file access.
DEFINT a-z
FUNCTION PBMAIN()
OPEN ENVIRON$("CGI_STDOUT") FOR OUTPUT AS #3
a$ = ENVIRON$("QUERY_STRING")
l = INSTR(a$, "://")
IF l THEN
a$ = MID$(a$, l + 3)
END IF
ip$ = EXTRACT$(a$, ":")
qs$ = "/" + REMAIN$(a$, "/")
ip$ = EXTRACT$(ip$, "/")
po = VAL(REMAIN$(a$, ":"))
IF po = 0 THEN
po = 80
END IF
PRINT #3, "<html><body>Connecting to <strong><font color=blue>" ip$
"</font></strong> port <font color=red><strong>";:
PRINT #3, po "</strong></font> query <font color=green><strong>" qs$
"</font><p><pre>
TCP OPEN PORT po AT ip$ AS #2 TIMEOUT 5000
IF ERR THEN
PRINT #3, ERROR$ + " connecting to server</pre></body></html>"
EXIT FUNCTION
END IF
TCP PRINT #2, "GET " + qs$ + " HTTP/1.0
TCP PRINT #2, "Host: " + ip$
TCP PRINT #2, "Connection: close"
TCP PRINT #2, "User-agent: Grabber 1.0"
TCP PRINT #2, ""
PRINT #3,
DO
TCP LINE #2, a$: PRINT #3, a$
INCR l
IF TRIM$(a$) = "" THEN
EXIT LOOP
END IF
LOOP
PRINT #3, "</strong><xmp>
WHILE NOT ERR
TCP LINE #2, a$: PRINT #3, a$
l = l + MAX(80, LEN(a$))
IF l > 1600 THEN
EXIT LOOP
END IF
WEND
TCP CLOSE #2
PRINT #3, "</xmp></body></html>"
END FUNCTION
-------------------------------------------------------------------------
--::Mailserver Verfaillie Bauwens::-- contact : postmaster@verfaillie.com
Alle mails gecontroleerd op virussen. Virusdefinities dagelijks aangepast
----------------------- http://www.verfaillie.com -----------------------