httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <rob...@profundis.nu>
Subject Re: [users@httpd] HTTPd 2.0 RH9.0 CGI UNIX sh GET form ARGC not 0 anymore?
Date Wed, 30 Jul 2003 08:00:56 GMT
Bob Mahan wrote:
> Using this sample snipet...
>
> <form method="get" action="/cgi-bin/script">
>   <input name=VAR1 type=hidden value="VALUE1">
>   <input name=CMNT type=text><input type=submit>
> </form>
>
> ...Under 1.3 /cgi-bin/script gets...
>
> ARGC=0,ARGV="",QUERY_STRING="VAR1=VALUE&CMNT=foobar"
>
> ...Under 2.0 /cgi-bin/script gets
>
> ARGC=1,ARGV="VAR1=VALUE&CMNT=foobar",QUERY_STRING="VAR1=VALUE&CMNT=fooba
> r"

I'm only guessing here, but this seems familiar, so I think it is possible
that Apache 2 introduced this behaviour.

> I thought I was being real slick when I wrote all these CGI programs to
> include not only the form generation, but the back end form processing
> in the same UNIX sh script and just look at the ARGC to see if the form
> generation (ARGC=1) or processing (ARGC=0) should be performed.  I'm
> praying that I have just not configured something right.

<pure_speculation>
    I doubt that if that behaviour was introduced in Apache 2, it is
possible to
    disable by a configuration directive. Sorry.
</pure_speculation>

Surely there must be more reliable ways to detect whether to generate the
form or process submitted data. You could possibly use POST method on the
form and check the environment variable REQUEST_METHOD to determine which
side of the script to use. I usually 'generate the form' unless a certain
query parameter is set to a certain value (hidden field in the generated
form), in which case I process the data.

The above suggestions might be a bit off, as I don't clearly see how you are
using this script. If so, please give a bit more detail on how the script
(form generating variant) is invoked (I don't understand why your script
would generate a form if ARGC is 1).

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message