Re: Re: CGIs with OSX
Re: Re: CGIs with OSX
- Subject: Re: Re: CGIs with OSX
- From: email@hidden
- Date: Sat, 31 Mar 2001 15:42:04 EST
In a message dated 3/31/01 11:09:20 AM, Tom of T&B wrote:
>
You can't just place an AppleScript script into the CGI-Executables
>
folder to make Apache talk to it. Apache (the web server software) sends
>
the form data to a unix shell script and doesn't know what to do with an
>
AppleScript binary file.
>
>
What you need is a unix shell scrip in the CGI folder that passes the
>
form data to your AppleScript script.
>
>
I tried this approach:
>
>
1. Created a shell script that looks like this:
>
>
#!/bin/sh
>
>
read postedFormData
>
>
/usr/bin/osascript 'tell app "My AppleScript CGI Applet" to handle CGI
>
request with posted data ' $postedFormData | echo
>
>
2. Set the appropriate permissions on the shell script and placed it in
>
the CGI Executables folder.
>
>
3. Resaved "My AppleScript CGI Applet" as a Mac OS X applet and launched
>
it.
>
>
But, when I tested it (by clicking submit on the web form), it didn't
>
work. I think it's a permission problem with the web server (www) not
>
having access to osascript etc. But the idea seems sound.
Yes, that was the consensus on macosx-l. Apache knows nothing of the W*API. I
have been assured by CJ Holmes of Starnine oops 4D, and Eric Zelenka has
assured me that MacOS X Server will support "Mac" CGIs in the next release.
I am intrigued by the idea of a shell script to pass the info to the
Applescript CGI. Here are the challenges/pitfalls I see (from my limited Unix
perspective):
- is "postedFormData" part of the Unix Shell "language?" Perl uses the%ENV
data wrapper. "postedFormData" seems too simple and, well, un-Unix-like in
its intuitiveness.
- when the Applescript CGI returns the full HTTP response, who does it return
it to? It wouldn't know to return it to Apache. Is that what the "| echo" is
for?
- the Applescript CGI expects a whole slew of environmental variable (see the
Standard Additions dictionary). Will not receiving them cause errors?
- CGIs that use WebSTAR's "send partial" command will obviously fail.
- other things I haven't thought of.
I plan to play with some of this stuff soon, but I am afraid that, even if I
can make it work, it will still be, at best, a kludge (but what a fun
kludge!). The "real" solution is for someone (Apple? The open source Darwin
crowd? The Apache group? Some enterprising hacker?) to bolt the W*API onto
Apache. Any takers?
Jeff Baumann
email@hidden
www.linkedresources.com
Why is 6.08 on an SE snappier than OSX on a Pismo 500?