Re: CGI Request Query Part II
Re: CGI Request Query Part II
- Subject: Re: CGI Request Query Part II
- From: Brian Johnson <email@hidden>
- Date: Wed, 7 Nov 2001 09:03:20 -0800 (PST)
On Wed, 7 Nov 2001, Steve Thompson wrote:
>
I have just discovered, following my posting of about 10 minutes ago,
>
that this doesn't work either
>
>
on handle CGI request
>
beep
>
end handle CGI request
>
>
or
>
>
on handle CGI request this_request
>
tell application "Finder"
>
display dialog "Hello"
>
end tell
>
end handle CGI request
>
>
So, it's clear that I don't understand how this handle CGI request
>
option works when you don't pass it an argument. The fact that I don't
>
get an error message for either of the scripts above implies that the
>
syntax is correct and you can do a "on handle CGI request".
>
>
So how do I get a CGI with no parameters to execute, query a couple of
>
scriptable applications and output the result as HTML? I have a script
>
that I thought did that, but http://10.1.0.150/pairerquery.cgi just
>
times out although pairerquery.cgi launches on the server (tried
>
personal Web sharing on 91 and AppleShare IP 6). Also
>
http://10.1.0.150/pairerquery.cgi?p=0 has the same effect.
>
>
TIA
>
>
Steve
The unadorned "on handle CGI request" should work fine. It won't work with
the OSX Apache server 'cause it doesn't support the appleevents interface
(though it will launch the cgi applet if it's not running).
Perhaps you are not returning a correct response? It's got to include the
header info, along the lines of ...
property OK_header : "HTTP/1.0 200 OK" & CRLF & "Server: WebSharing/1.5.2"
& CRLF & "MIME-Version: 1.0" & CRLF & "Content-type: text/html" & CRLF &
CRLF
and it's got to be returned to the browser. In your examples, if you just
want the script to get your attention and prove it's running, insert an
"activate me" in front of the beep or display dialog.
Finally, I've found PWS a bit flakey with my applescript CGIs. Sometimes
it comes to the conclusion that files are open elsewhere (perhaps the
server's got them open, but not me), etc. Still, I have users who seem
satisfied, so I think it really does work. It's just a matter of working
out a few wrinkes.
HTH.
Brian Johnson, Dept of Architecture, University of Washington, Seattle