Wow, Jeff, it's incredibly kind of you to have written this extension in 
response to my query.

I did find a small bug with the code you sent, namely that it also appended 
.adp to urls that ended with /, so you'd get a request for 
"http://localhost/.adp"; when you tried to load "http://localhost"; 

Below is how I fixed the code to avoid that small bug (a check for a trailing 
/).  Otherwise, your code works beautifully!  

Do you want to go ahead and check in to bitbucket that small change I've made?

-john


int
DefExtProc(void *arg, Ns_Conn *conn, int why)
{
        char *url;
        char **urlv;
        int urlc;
        Tcl_DString ds;

        url=conn->request->url;
        urlv=conn->request->urlv;
        urlc=conn->request->urlc;

        if (url[strlen(url) - 1] != '/') {
                if (!Tcl_StringMatch(urlv[urlc-1],"*.*")) {
                        Ns_Log(Debug,"Adding trailing .adp to url");
                        Tcl_DStringInit(&ds);
                        Tcl_DStringAppend(&ds,url,-1);
                        Tcl_DStringAppend(&ds,".adp",4);
                        Ns_SetRequestUrl(conn->request, Tcl_DStringValue(&ds));
                        Tcl_DStringFree(&ds);
                }
        }

        return NS_OK;
}


------------------------------------------------------------------------------
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to