qsparse
目次
2006/08/24 Update
Usage
qsparse [-r] [-s size] [query]
Description
This program analyzes query that is based on x-www-form-urlencoded format and places the results in environment variables.For example, if we execute:
qsparse 'name=alice&age=18'then environment variables
QS_name
and QS_age
are created, and their contents are 'alice' and '18' respectively.Prefix
QS_
are put to each names because we should protect system environment variables against malicious clients.
The meaning of options and argument are as follows:
-r
option is a dummy for compatibility. Now "qsparse" removes non-pritable codes from environment variable without this option.
-s size
specify buffer size to read query. [default=16KB]
- if
query
is omitted, then "qsparse" reads query from stdin.
qsparse
is designed to process simple query, that is:- in case of repeated names in query, "qsparse" put them into an array elements.
- there is an upper limit of the size of environment variable
qsparse
assumes the names in query consist of alpha-numeric
More examples
More examples are given below.qsparse 'name=alice+bob&name=carol'which gives shell variable by
name=`{echo /env/QS_name}and the result will be
('alice bob' carol)
No named attributes will produce "QS_
". The example is
qsparse 'alice+bob&carol'which gives shell variable by
noname=`{echo /env/QS_}and the result will be
('alice bob' carol)The mixture of named and no named is allowed.
Now we need not qsparse.
Now Pegasus 2.2 support query string decoding internally.Therefore "qsparse" is not necessary. If server accept query string, then environ variables are automatically produced with the name that begin with "
QS_
", the same rule as "qsparse".