httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Mahan" <bob.ma...@sbcglobal.net>
Subject RE: [users@httpd] HTTPd 2.0 RH9.0 CGI UNIX sh GET form ARGC not 0 anymore?
Date Wed, 30 Jul 2003 15:15:44 GMT
Thanks for your thoughts Robert. I have gone throught the httpd.conf
file again and still don't see anything in there that might be causing
this behavior.  Here is a little better picture of what I'm doing that
is causing this problem.

Menu web page:

  <a href="/cgi-bin/form?SOME-DATA">link</a>

CGI shell script "form":

  if [ $# -eq 1 ] ; then
    KEY=$1                       # gets value "SOME-DATA"
    (generate form from KEY...)
      <form method="get" action="/cgi-bin/form">
      <input name=VAR1 type=hidden value="VALUE1">
      <input name=CMNT type=text><input type=submit>
      </form>
  else
    (parce QUERY_STRING)
    (do backend stuff)
  fi

For right now as a quick bandaide I have done exactly what you have
suggested about looking into the QUERY_STRING to see if it set a hidden
variable from the form with something like this:

#  if [ $# -eq 1 ] ; then   # NOT WORKING WITH APACHE 2.0 !!
   if [ -z "`echo $QUERY_STRING | grep ^VAR1=`" ] ; then
    KEY=$1                       # gets value "SOME-DATA"

I will go back and see what kind of behavior and values the
REQUEST_METHOD variable has and maybe that would be a better approach,
at least until v3.0? ;)

> Robert Andersson wrote:
> 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=foo
> 
> I'm only guessing here, but this seems familiar, so I think 
> it is possible that Apache 2 introduced this behaviour.
> 
> 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).
> 



---------------------------------------------------------------------
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