[BusyBox] httpd CGI Forms Parameter Names

Glenn Engel at Home glenne at engel.org
Thu Sep 11 02:33:40 UTC 2003


You're probably best off not using special characters in parameter names
with busybox httpd if you are using the CGI_vars feature.  Since these are
ultimately passed to setenv it's best not to use special characters for
variable names.  Note that if you use variable_1 variable_2 it would be easy
enough to convert them to arrays in your cgi shell script.

--
Glenn
----- Original Message ----- 
From: "Kianusch Sayah Karadji" <kianusch at sk-tech.net>
To: <busybox at mail.codepoet.org>
Sent: Wednesday, September 10, 2003 2:01 AM
Subject: [BusyBox] httpd CGI Forms Parameter Names


> Hi (again)!
>
> Parameter names arive URL-encoded and are not decoded by httpd, so passing
>
>    variable[0]
>    variable[1]
>
> result in ...
>
>   variable%5B0%5D
>   variable%5B1%5D
>
> changing line 765 in httpd from
>
>       addEnv("CGI", name, decodeString(value, 1));
>
> to
>
>     addEnv("CGI", decodeString(name,1), decodeString(value, 1));
>
> would pass the names correctly (ignoring other side-effects :-)
>
> And with the correct shell (like ksh - not in ash :-( ) one could parse
> those variables in an efficent manner as array.
>
> Ever better would be not to decode all HTTP-Entities, but only the square
> brakets for variable names like this construction...
>
>     if (!((*ptr == '%' && *(ptr+1) == '5') && (*(ptr+2)=='B' ||
*(ptr+2)=='D'))) *string++ = *ptr++;
>     else  {
>       unsigned int value;
>       sscanf(ptr+1, "%2X", &value);
>       *string++ = value;
>       ptr += 3;
>     }
>
> Regards
>   Kianusch
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://busybox.net/mailman/listinfo/busybox
>
>




More information about the busybox mailing list