QUERY_STRINGenvironment variable parsing for CGI scripts. It comes with W3C httpd distributions 2.15 and newer.
QUERY_STRING environment variable is not set, it
CONTENT_LENGTH characters from its standard input.
296c296,297 < printf("QUERY_STRING='%s'; export QUERY_STRING\n", query_string) ; --- > printf("QUERY_STRING=%s; export QUERY_STRING\n" > , sh_escape(query_string)) ;
QUERY_STRINGas search keywords. Keywords are decoded and written to standard output, one per line.
QUERY_STRINGas form request. Outputs a string which, when
eval'ed by Bourne shell, will set shell variables beginning with
FORM_appended with field name. Field values are the contents of the variables.
QUERY_STRINGas form request. Prints only the value of field fieldname.
stdinand write them to
QUERY_STRINGis not defined, read
stdinand output a string that when
eval'd by Bourne shell it will set
QUERY_STRINGto its correct value. This can be used when the same script is used with both
POSTmethod. Typical use in the beginning of Bourne shell script:
eval `cgiparse -init`After this command the
QUERY_STRINGenvironment variable will be set regardless of whether
POSTmethod was used. Therefore
cgiparsemay be called multiple times in the same script (otherwise with
POSTit could only be called once because after that the
stdinwould be already read, and the next
-valuedefault is newline
-formdefault is ", "
-form.Specify the prefix to use when making up environment variable names. Default is "FORM_".
-keywordsoutputs the number of keywords
-formoutputs the number of unique fields (multiple values are counted as one)
-valuefieldname gives the number of values of field fieldname (no such field is zero, one field gives 1, one multiple 2, etc).
-number , e.g.
-keywordsgives n'th keyword
-formgives all the values of n'th field
-valuefieldname gives n'th of the multiple values of field fieldname (first value is number 1).
-k -f -v -r -i -s -p -c -q
1Illegal command line
2Environment variables not set correctly
3Failed to get requested information (no such field,
QUERY_STRINGcontains keywords when form field values requested, etc).
QUERY_STRINGis already set by the server.
$ is the Bourne shell prompt.
$ QUERY_STRING="is+2%2B2+really+four%3F" $ export QUERY_STRING $ cgiparse -keywords is 2+2 really four? $
$ QUERY_STRING="name1=value1&name2=Second+value%3F+That%27s right%21" $ export QUERY_STRING $ cgiparse -form FORM_name1='value1'; FORM_name2='Second value? That'\''s right!' $ eval `cgiparse -form` $ set ... FORM_name1=value1 FORM_name2=Second value? That's right! ... $
QUERY_STRING as in previous example. $ cgiparse -value name1 value1 $ cgiparse -value name2 Second value? That's right! $