Patch by Niko Tyni for perl-CGI-SpeedyCGI >= 2.22, which allows empty strings as command-line parameters. --- CGI-SpeedyCGI-2.22/src/speedy_frontend.c 2003-10-07 06:03:48.000000000 +0200 +++ CGI-SpeedyCGI-2.22/src/speedy_frontend.c.empty_param 2008-05-04 20:19:05.000000000 +0200 @@ -540,6 +540,27 @@ ADDCHAR(b, 0); } +/* Copy a block of strings into the buffer, including empty strings */ +static void add_strings_with_empty(register SpeedyBuf *b, register const char * const * p) +{ + int l; + register const char *s; + + /* Add strings in p array */ + for (; (s = *p); ++p) { + if ((l = strlen(s))) { + ADD_STRING(b, s, l); + } else { + /* add a 1-byte long string containing just '\0' */ + l = 1; + ADD_STRING(b, s, l); + } + } + + /* Terminate with zero-length string */ + ADDCHAR(b, 0); +} + void speedy_frontend_mkenv( const char * const * envp, const char * const * scr_argv, int min_alloc, SpeedyBuf *sb, int script_has_cwd @@ -560,7 +581,7 @@ /* Add env and argv */ add_strings(sb, envp); - add_strings(sb, scr_argv+1); + add_strings_with_empty(sb, scr_argv+1); /* Put script filename into buffer */ add_string(sb, script_fname, strlen(script_fname));