Valerio Gionco <[EMAIL PROTECTED]> writes:
> We are trying to port a big CGI application written in TCL to mod_dtcl.
Cool!
> In some cases, the application calls a CGI setting the same variable
> to more than a value, like in this example (for a GET):
> http://valerio.private/valerio/test.tcl?x=v1&x=v2&x=v3
> Internally our code parsed the URL making something equivalent to
> set $x "v1|||v2|||v3"
> using "|||" as a separator. We patched the source code of mod_dtcl
> to comply with this format, and I think something similar
> (eventually more flexible) should be included in the module.
Damn, I must have accidentally left this out when I converted
everything to the apreq stuff:-(
Anyway, the relevant piece of code is this, now:
Tcl_Obj *varsobj = Tcl_NewStringObj("::request::VARS", -1);
for (i = 0; i < parmsarray->nelts; ++i)
{
if (!parms[i].key)
continue;
else {
/* All this is so that a query like x=1&x=2&x=3 will
produce a variable that is a list */
Tcl_Obj *newkey = STRING_TO_UTF_TO_OBJ(parms[i].key);
Tcl_Obj *newval = STRING_TO_UTF_TO_OBJ(parms[i].val);
Tcl_Obj *oldkey = Tcl_ObjGetVar2(interp, varsobj, newkey, 0);
if (oldkey == NULL)
{
Tcl_ObjSetVar2(interp, varsobj, newkey, newval, 0);
} else {
Tcl_Obj *concat[2];
concat[0] = oldkey;
concat[1] = newval;
Tcl_ObjSetVar2(interp, varsobj, newkey, Tcl_ConcatObj(2, concat),
0);
}
}
}
This results in one big long list without sub-lists. If you don't do
the concat, and instead try and use TCL_APPEND_VALUE and
TCL_LIST_ELEMENT as flags to the setvar, you get sublists in your
list, which print like "blah blah {foo bar}", and that doesn't look
very good...
I have committed the above change to CVS and will roll a new release
soon with it.
Does that do more or less what you need?
--
David N. Welton
Free Software: http://people.debian.org/~davidw/
Apache Tcl: http://tcl.apache.org/
Personal: http://www.efn.org/~davidw/
Work: http://www.innominate.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]