Re: [Speedycgi-users] My non-CGI scripts parameters are getting correupted
Brought to you by:
samh
|
From: Sam H. <sa...@da...> - 2002-03-31 09:33:14
|
Here's a patch for the 2.11 source. The old code just split up all the
args on whitespace. The new code only splits the args that contain perl
and speedy options .
*** /tmp/CGI-SpeedyCGI-2.11/src/speedy_opt.c Mon Mar 19 03:55:29 2001
--- speedy_opt.c Sun Mar 31 01:00:24 2002
***************
*** 128,164 ****
StrList *speedy_opts, StrList *script_args
)
{
! StrList split;
! char **p;
/* Arg-0 */
if (arg0)
*arg0 = speedy_util_strdup(*in);
++in;
! /* Split on spaces */
! strlist_init(&split);
! strlist_split(&split, in);
! p = strlist_export(&split);
!
! /* Perl args & Speedy options */
! for (; *p && **p == '-'; ++p) {
! if (p[0][1] == '-' && p[0][2] == '\0') {
! for (++p; *p && **p == '-'; ++p)
! strlist_append(speedy_opts, *p);
break;
- } else {
- strlist_append(perl_args, *p);
}
- }
! /* Script argv */
! if (script_args) {
! for (; *p; ++p)
! strlist_append(script_args, *p);
}
!
! strlist_free(&split);
}
--- 128,187 ----
StrList *speedy_opts, StrList *script_args
)
{
! int doing_speedy_opts = 0;
/* Arg-0 */
if (arg0)
*arg0 = speedy_util_strdup(*in);
++in;
! for (; *in; ++in) {
! char **p;
! StrList split;
!
! /* Split on spaces */
! {
! const char *temp[2];
!
! temp[0] = *in;
! temp[1] = NULL;
! strlist_init(&split);
! strlist_split(&split, temp);
! p = strlist_export(&split);
! }
!
! /*
! * If there are no options in this arg, give the whole unsplit
! * piece to the script_argv.
! */
! if (!*p || **p != '-') {
! strlist_free(&split);
break;
}
! /* Perl args & Speedy options */
! for (; *p && **p == '-'; ++p) {
! if (!doing_speedy_opts)
! if ((doing_speedy_opts = (p[0][1] == '-' && p[0][2] == '\0')))
! ++p;
! if (*p)
! strlist_append(doing_speedy_opts ? speedy_opts : perl_args, *p);
! }
!
! if (*p) {
! ++in;
! /* Give the remaining non-options in this arg to the script */
! if (script_args)
! strlist_concat2(script_args, (const char * const *)p);
! strlist_free(&split);
! break;
! }
! strlist_free(&split);
}
!
! /* Take the remaining args (without splits) and give to script_args */
! if (script_args)
! strlist_concat2(script_args, (const char * const *)in);
}
>
> I am using speedy with a non-CGI script and the parameters are getting
> corrupted.
>
> i.e: what should be one single parameter is being broken up into many
> seperate parameters.
>
> has anyone else had this problem?
>
> (I have worked around this by using <STDIN> to pass the data into my
> script, but I would ideally like to use command-line parameters).
>
> thanks, mark.
>
> _______________________________________________
> Speedycgi-users mailing list
> Spe...@li...
> https://lists.sourceforge.net/lists/listinfo/speedycgi-users
|