Scott Raney wrote:
> 
> On Wed, 24 Nov 1999, David Bovill wrote:
> 
> > Thanks, I think that's what I figured. I was wandering how to keep the
> > "compatibility" with ".mt", perl and other cgi's (not really apple events).
> > The question is more, how do I program a CGI which can easily be ported to
> > Perl, or ".mt" scripts? As these ways of implementing CGI's rely heavily on
> > the "Environmental variables" defined I think by the server??? then it makes
> > sense to implement them by scripting stuff like:
> >   put the legnth of putStuffComingfromStdin into $CONTENT_LEGNTH
> 
> This would work fine on UNIX systems (except you'd have to spell it
> right ;-)
> 

> 
> Another method to consider is to pass all of the "environment
> variables" as a parameter array.  This is pretty much equivalent to
> the AppleEvent system used on Macs, but much simpler (and faster).
> Here's something that would do the same thing as the echo.mt script,
> except run as a handler within mchttpd:
> 
> on mouseUp
>   put "GET" into cgiParams["REQUEST_METHOD"]
>   put "HTTP/1.0" into cgiParams["SERVER_PROTOCOL"]
>   mycgi cgiParams
> end mouseUp
> 
> on mycgi myparams
>   repeat for each line l in keys(myparams)
>     put l && "=" && myparams[l] & cr after it
>   end repeat
>   put it
> end mycgi


As i am just working on the port of my MacOS+WebStar+Hypercard acgi
application server to the Linux+Apache+Metacard issue of the same
server, i have found many help in reading the list. Thank's to all. See
if the basics of my configuration can help :

System installed : Suse Linux 6.2, Apache 1.3.6, Metacard 2.2.5 (full
development version, in the home directory of a standard user, not root)
on a SN6000 Samsung notebook.

No changes needed in the access.conf, httpd.conf and srm.conf files.

A link (alias, on mac) of the "mc" program put in the Apache cgi-bin
directory.

A sap.mt script and a sap.mc stack put in the same cgi-bin directory.

A basic "sap.html" post form put in the "htdocs" directory.

All the permissions of the "/usr/local/httpd/" subdirectorys sets to
"yes,yes,yes" for the user, "yes,no,yes" for the group and "yes,no,yes"
for others.

The contents of "sap.mt" (in place of the MacOS based "on appleEvent"
handler) :

#!mc
on startup
  global ExAE
  repeat with each item i in the globals
    put i && "=" && value(i) & return after ExAE
  end repeat
  send runsap to stack "sap.mc"
end startup

The contents of "sap.mc" (in place of the MacOS Hypercard/Metacard acgi
stack) :

on runsap -- write minimal set of HTTP headers to stdout
  global ExAE
  if ExAE contains "$REQUEST_METHOD = GET"
  then put empty -- "Get" requests not accepted on this server
  else
    read from stdin until empty
    put it into inPost
    put "Content-Type: text/plain" & cr & "Content-Length:" && the
length of ExAE & cr & cr into entete
   
    -- put there all what you need to be do by the cgi stack
    put entete & ExAE & cr & "Py" && random(100)+90 & cr & cr & inPost
into outPost
    -- end of what the cgi stack as to do

    put outPost
  end if
end runsap

The contents of "sap.html" (the same as on MacOS) :

<html><head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="WebMaker 0.8">
<title>Bienvenue au CRDP de Cr&#233;teil</title></head>
<body background="/gif/bg.gif"><form method="POST"
ACTION="/cgi-bin/sap.mt">
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td width="15%" valign="middle"><font size="7"
color="white"><i><b>Cyberboutique du CRDP de l'acad&#233;mie de
Cr&#233;teil</b></i></font></td>
<td width="85%" valign="middle"><img src="/gif/logocr.gif"
align="right"></td>
</tr></table>
<table border="0" cellpadding="0" cellspacing="10" width="100%"><tr>
<td width="33%" valign="middle" align="right"><input type="submit"
value="Envoyer" name="ENV"><SPACER TYPE="block" WIDTH="5"
HEIGHT="1"><input type="reset" value="Annuler"></td>
</tr></table>           
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td width="40%" valign="middle"><img src="/gif/madeW.gif"
align="left"></td> 
<td width="60%" valign="middle"><img src="/gif/apache_pb.gif"
align="right"></td> 
</tr></table>
</form></body></html>

To see the result, just lauch Netscape...

 
> As shown above, we could use the standard *names* for the various
> parameters if this is deemed desirable.  And if the above looks like
> greek to you, you should get the 2.3 beta and play around with this
> script in it.  Setting and passing arrays around like this is an
> important technique to understand as it greatly simplifies some kinds
> of problems.
> 
> > I like this idea. The problem I am having with it at the moment is that
> > according to a recent post adding a new cgi will only be possible in the
> > full development environment. If I am right this is because setting the
> > script length to greater than 10 lines will not be possible in the starter
> > kit. The only solution is to "do" 1 line at a time, or limit cgi's to 10
> > lines!
> 
> *Adding* a new CGI of any size would no problem.  Developing one of
> non-trivial complexity without a license could be difficult, though.
>   Regards,
>     Scott


David, if you plain to jump to the full development environment and want
to get the best from the Metacard power, go to Linux too (LinuxPPC 1999
on mac or SUSE 6.2/6.3 on PC are coming with very cleans and usefulls
X-video modes management utilities).

Wy Linux ? Try just to imagine what you would be able to do using
Hypercard or Metacard on MacOS, if HC/MC could interact, directly with
any others programs and any part of the system, without to have to use a
specific gateway (AppleEvents, OSA compatible scripting tools like
AppleScript, QuickKeys, KeyQuencer, even HC/MC it self or the bluebox on
MacOS X) just by sending Hypertalk/Metatalk embbeding commands to all of
those programs or system routines...

Where Hypercard will, probably never be able to do that, Metacard do it
natively on Unix systems and it's not all : first, it can act as a very
fine cgi application server without to have to requere the help of any
XCMD. All the needs are covered by built-in commands; second, if
Linux+Apache+Metacard and MacOS+WebStar+Hypercard are, in theory, able
to do the same work, the first configuration run, in practice, up to
20/1 faster than the second. Last but not last, the "mchttpd.mc" stack
will probably become a very usefull piece of dream soft to built
incredible client-side browsers but it's an other story...


Best Regards,

Pierre
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pierre Sahores           CRDP de l'academie de Creteil
Tel.: +33 143247509      20, rue Daniele-Casanova
Fax.: +33 148726072      94170 Le Perreux - France
[EMAIL PROTECTED]      http://www.crdp.ac-creteil.fr
Web applications servers design, XTalk's, MacOS, Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to