Re: ACGI form parsing in OSX?
Re: ACGI form parsing in OSX?
- Subject: Re: ACGI form parsing in OSX?
- From: Reinhold Penner <email@hidden>
- Date: Thu, 31 Jan 2002 21:27:54 -1000
Jeff,
James, I'm glad you're on board for getting ACGIs working in X. The
handler
for parsing that you provided is incomplete. We (OK, I) need a way to
deal
with the fact that form POST data arrives URL encoded. My experience is
that
pure Applescript approaches to this are sloooooow.
With all this talk of the Unix, is there a way to do this with the
shell?
Anyone?
I have a partial answer in Perl, which I have running to handle incoming
posts, but I don't know how to translate this into a do a shell script.
So maybe someone will help us get multi-line perl scripts to run in the
shell and return the processed results. This is a simplified version of
what my perl script does:
#here we determine whether it's a post or get method
$method=$ENV{REQUEST_METHOD};
if ($method =~/get/i)
{
$input = $ENV{QUERY_STRING};
}
else
{
read (STDIN, $input, $ENV{CONTENT_LENGTH});
}
#now we have the full request in and split it up into name=value pairs
($comm, $value) = split(/=/, $input);
if ($comm eq "keyname")
{
#here is the key for URL decoding
$value =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge;
}
... quite a bit more stuff follows that writes stuff to files, but the
essential part for URL decoding is listed above.
So if anyone can tell us how to run this regular expression substitution
in the shell, we should have a nice URL decoder.
-Reinhold