[BusyBox] How to get parameter httpd.?

Ralph Siemsen ralphs at netwinder.org
Tue May 10 19:14:29 UTC 2005


HS8JCV wrote:
> Hi all
> I will get parameter from get method on web page form.
> Example: test.cgi?a1=value1&a2=value2
> How to get value of a1 and a2 in cgi file.

The entire string "a1=value1&a2=value2" is passed in environment 
variable (GET method) or on stdin (POST method).  You can read in in the 
CGI script as appropriate, depending which language you use to write 
your CGI.

For decoding the strings, you can use ready-made libraries for this, for 
example, CGI.pm for perl, or libcgi for C language.  You can even do it 
with bash shell.  If your requirements are not very complicated you can 
write your own decoder routine fairly easily (but it is tricky to handle 
all the possible cases securely, so you are best to use existing code).

Note that busybox httpd includes the ability to encode and decode the 
URL encoding of the string... that is the hardest part.  See the 
comments at the beginning of busybox/networking/httpd.c

-R



More information about the busybox mailing list