From: Stephen D. <sd...@gm...> - 2005-12-31 11:54:48
|
On 12/31/05, Zoran Vasiljevic <zv...@ar...> wrote: > > Am 31.12.2005 um 01:15 schrieb Gustaf Neumann: > > > > > Class Filter > > Filter instproc preauth args { .... } > > Filter instproc postauth args { .... } > > > > Damn, you are right. In which case we'd do: > > ns_register_filter <reason> GET /junk myfilter myarg1 myarg2 ... > > and it would call the filter as: > > myfilter <reason> myarg2 myarg3 > > Understand. This would allow you to: > > Class TheFilter > TheFilter proc preauth {arg1 arg2} {...} > TheFilter proc postauth {arg1 arg2 arg3} {...} > > ns_register_filter preauth GET /junk TheFilter arg1 arg2 > ns_register_filter postauth GET /junk TheFilter arg1 arg2 arg3 > > and we'd call > > TheFilter preauth arg1 arg2 > TheFilter postauth arg1 arg2 arg3 > > The proc way would be: > > proc TheFilter {reason args} {...} > > and it would naturally fit in, as with OO syntax. > > Well, this certainly makes sense to me. This is clean and elegant. > Hm... this will however be an incompatible change to the way AOL > server is handling the task, but will be way more sexy. > > This is what I mean (others can comment): I'd go after this change. > For the people not using any optional arguments, there would be no > compatibility issues. For those using the arguments, they'd have to > rewrite the code. But it is for the better, not worse. > > Stephen, Vlad, what do you think? I have no problem with that > as we are not using any of the optional args in our code. > We might examine to modify ns_register_proc the same way. The order: TheFilter preauth arg1 arg2 makes the most sense to me. The <when> is not an optional arg, it's always appended. Required args always come before optional args in proc specs... If we changed this, we should also change Ns_TclEvalCallback() in the same way. A proc registered with ns_serverrootproc may have the host appended as the last arg. It uses Ns_TclEvalCallback() directly. ns_register_proc doesn't append information of it's own. But it does insist on appending a blank arg if none were supplied during registration. I'd like to remove that as it's easy to write code which works with either case. |