From: John B. <jo...@ma...> - 2014-07-09 20:31:42
|
I was wondering if there was simple of of defining the default filename extension naviserver looks for, like there is for "ns_param directoryfile" but for any url where the filename extension isn't specified in the url. For example, if you go to: http://localhost/about I want "about.adp" to be the file that is loaded. I've done this in aolserver two ways: 1) with a 404 handler 2) or with a code path in request.c (see code sample below) -john ==== /* john buckman added 4/14/06 */ /* check if should add default filename extension of .adp */ /* only if no / on end of url which indicates a directory */ char * dotpos; if (ds2.string[ds2.length - 1] != '/') { /* if not . in the entire url, or if there is a dot before the final / (indicating a . in a directory name, which is ok, then add the default filename extension */ dotpos = strrchr(ds2.string, '.'); if ((dotpos == NULL) || (strchr(dotpos, '/') != NULL)) { Ns_DStringAppend(&ds2, ".adp"); /* Ns_Log(Notice, "added default extension to get '%s'", ds2.string); */ } } /* end john buckman added */ request->url = ns_strdup(ds2.string); === |