CGI Tools

qsparse

usgae: qsparse [-r] [-s size] [query]
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.

Option -r is used to remove CR codes from the values.
If query is omitted qsparse read query from stdin; the usage is for POST method.
By option -s, we can specify buffer size when query is read from stdin; the default value is 16KB.

qsparse is intended for simple query, that is:

  1. in case of repeated names in query, qsparse put them into an array elements.
  2. there is an upper limit of the size of environment variable
  3. qsparse assumes the names in query consist of alpha-numeric

formparse

usgae: formparse [-r] [-o dir] [query]
This program analyzes query that is based on x-www-form-urlencoded format and places the results in the directory [default /tmp].

Option -r is used to remove CR codes from the values.
If query is omitted qsparse read query from stdin; the usage is for POST method.
By option -o, we can specify the directry the results are placed.

formparse is intended to deal with large data.

formparse creates files shown bellow:

	/tmp/name/0
	/tmp/name/1
	/tmp/name/2
	...
	/tmp/name/clone
where `name' is a variable name, under which files named 0, 1, ..., are created; the contents are the values of the variable.

Note: currently formparse does not support multipart/form-data. I hope to support it in next release. (multipart/form-data is used to send files.)