On Tue, Jan 17, 2017 at 9:43 PM, Gustaf Neumann <neum...@wu.ac.at> wrote:
>
> Dear Stephen and all,
>
> That is a neat idea! The only disadvantage is, that the order of
> registration is important,
> which can can lead to fiddling with the config file and to some not easy
> predictable behavior.


Does it make any difference in practice?  Looks like the filters are
stored sorted according to this order:

  
https://bitbucket.org/naviserver/naviserver/src/57c84d3671e7127ae42f3754463dead32b04f256/nsd/urlspace.c?at=default&fileviewer=file-view-default#urlspace.c-1141

Which tends to match more specific filters first.

This test looks looks good. Does it still work if /* and /*.* are
registered after the others?


> The behavior can be neatly demonstrated with ns_urlspace
> (using X as a special key for testing purposes).
>
> =============================================================
> test ns_urlspace-5.2 {wild-card-filter with ordering} -setup {
>      ns_urlspace set -key X /*        ADP
>      ns_urlspace set -key X /*.adp    ADP
>      ns_urlspace set -key X /*.tcl    TCL
>      ns_urlspace set -key X /*.*      FILE
>      ns_urlspace set -key X /static/* FILE
> } -body {
>      foreach url {
>         /test.adp /test.txt /test.tcl /test
>         /static/test.adp /static/test.txt /static/test.tcl /static/test
>      } {
>         lappend _ [ns_urlspace get -key X $url]
>      }
>      set _
> } -cleanup {
>      unset -nocomplain _
> } -result {ADP FILE TCL ADP FILE FILE FILE FILE}
> =============================================================

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to