<HTML><FONT FACE=arial,helvetica><FONT COLOR="#000000" FACE="Geneva" FAMILY="SANSSERIF" SIZE="2" STYLE="BACKGROUND-COLOR: #FFFFFF">Hi guys,<BR>
<BR>
With all of this CGI talk lately, I cooked something up.<BR>
I've been working with a server program based on the ol' mc httpd stack, since I make heavy use of Valentina. However, I've always wanted to break it down into separate cgi scripts. Among other things, that gives me multiple processes more easily.<BR>
<BR>
So my question... is there *any* way to access externals (including the new Mach-o ones with 2.4.3) from a CGI script?<BR>
<BR>
The best I can come up with is running a separate stack which houses the external, and communicating via sockets.<BR>
<BR>
Any ideas?<BR>
<BR>
In case anyone finds this script useful, this is what I'm using to talk to my mc httpd-inspired stack:<BR>
<BR>
#!mc<BR>
on startup<BR>
open socket to "127.0.0.1:8080"<BR>
<BR>
put $REQUEST_METHOD&&$REQUEST_URI&&"CGI"&crLF into theRequest<BR>
if ($HTTP_COOKIE is not empty) then<BR>
put "Cookie: "&$HTTP_COOKIE&crLF after theRequest<BR>
end if<BR>
if ($REMOTE_USER is not empty) then<BR>
put "Remote-User:"&&$REMOTE_USER&crLF after theRequest<BR>
end if<BR>
<BR>
if ($REQUEST_METHOD = "PUT") then<BR>
read from stdin until empty<BR>
put crLF&it after theRequest<BR>
end if<BR>
<BR>
write theRequest&crLF&crLF to socket "127.0.0.1:8080"<BR>
<BR>
read from socket "127.0.0.1:8080" until (crLF&crLF)<BR>
put it into theHeaders<BR>
put lineOffset(theHeaders, "Content-Length:") into theLine<BR>
if (theLine > 0) then<BR>
set the itemDelimiter to ":"<BR>
put item 2 of line theLine of theHeaders into theLength<BR>
read from socket "127.0.0.1:8080" for theLength<BR>
put it into theBody<BR>
else<BR>
read from socket "127.0.0.1:8080" until empty<BR>
put it into theBody<BR>
end if<BR>
<BR>
## delete the status line<BR>
delete line 1 of theHeaders<BR>
put (theHeaders&crLF&crLF&theBody)<BR>
end startup<BR>
<BR>
Best Regards,<BR>
Brian</FONT><FONT COLOR="#000000" FACE="Geneva" FAMILY="SANSSERIF" SIZE="2" STYLE="BACKGROUND-COLOR: #FFFFFF"></FONT></HTML>