Forum OpenACS Development: export_vars & export_entire_form_as_url_vars

Hello there,

I think I have found an obscure bug in the aforementioned procs. It is very easy to reproduce for export_vars, but also the other proc is affected.

Try this code

set test --
export_vars {test}


set -- whatever
export_vars {"--"}

It will complain about wrong args in ns_urlencode. This is because the "--" has special meaning for ns_urlencode, separating flags from arguments.

If you replace all ns_urlencode calls into the procs from

ns_urlencode $var


ns_urlencode -- $var

things go ok.

NOTE: current export_vars encodes url path AND variables using the same ns_urlencode, which is wrong AFAIK.

export_entire_form_as_url_vars encodes variables using ad_urlencode_query instead, which should be the right way to go. I think we should fix this, as export_vars should be the preferred interface for exporting.

If someone confirms this is a bug I can take care of the fix.

All the best

Posted by Gustaf Neumann on
It is a bug. The problem comes form the fact, that aolserver's urlencode did not distinguish between the coding for the "path" part or the "query" part (which is slightly different according to the RFC) - which is what you noted as well.

NaviServer makes the distinction, but it might spit out the message that you saw. In order to keep aolserver compatibility, I've defined a while ago [ad_urlencode_path ...] and [ad_urlencode_query ...], which is defined also for aolserver...

all the best

Posted by Antonio Pisano on
Ok, so I will just use the two procs instead of ns_urlencode to fix.


Posted by Antonio Pisano on
Done, I had some trouble committing because I initially worked on HEAD, but I've cleaned my mess.

Please let me know if any problem occours.

All the best.