|   | ![[ Previous ]](navbprev.gif)  ![[ Contents ]](navbhome.gif)  ![[ Index ]](navbhelp.gif)  ![[ Next ]](navbnext.gif)  | 
    int Ns_UrlToFile(
    Ns_DString *dest,
    char *hServer,
    char *URL
    );
The Ns_UrlToFile function writes the full path name of the file corresponding to the given URL. The result is appended to the Ns_DString. The function does not check that the file exists or is readable by the AOLserver process. This function returns a status of NS_OK or NS_ERROR.
    /* A simple page fetch request function. */
    int
    SimpleFetch(Ns_Conn *conn, void *ctx)
    {
    	Ns_DString ds;
    	FILE fp;
    	char *server;
    
    	Ns_DStringInit(&ds);
    	server = Ns_ConnServer(conn);
    	Ns_UrlToFile(&ds, server, conn->request->url);
    	fp = fopen(ds.string, "r");
    	Ns_ConnSendOpenFp(conn, fp, -1);
    	fclose(fp);
    	Ns_DStringFree(&ds);
    	return NS_OK;
    }