On Jul 9, 2014, at 3:00 PM, Jeff Rogers <dv...@diphi.com> wrote: > There's no builtin way I know of to define a default extension. I would > do this with a preauth filter, something like this:
The preauth filter is a nice way to do it, albeit with a bit of file existence checking overhead for every request that I'd prefer avoid. The way my C code worked (see previous msg) was to look to see if the request url has no extension, and no trailing / on it either, and then to append .adp in that case. That has the advantage of being very low overhead. As you noted, Apache has this with MultiViews, and I use that feature extensively on Magnatune.com so that URLs look nice and clean, ie: http://magnatune.com/artists/linda_wood So yes, I'd vote for this to be a config level feature, since it's already in Apache that way. Looking at request.c it looks to me like the action happens in the "SetUrl" function. Specifically, there already is logic in here to deal with trailing slashes, so a default filename extension feature would slot in well at this point: /* * Append a trailing slash to the normalized URL if the original URL * ended in slash that wasn't also the leading slash. */ while (*url == '/') { ++url; } if (*url != '\0' && url[strlen(url) - 1] == '/') { Ns_DStringAppend(&ds2, "/"); } /* john - check to see if a default_extension has been set in the config file, and if so, append it now if appropriate. */ request->url = ns_strdup(ds2.string); Ns_DStringFree(&ds2);
------------------------------------------------------------------------------
_______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel