[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_UrlToFile

Overview

Construct the filename that corresponds to a URL

Syntax

    int Ns_UrlToFile(
    Ns_DString *dest,
    char *hServer,
    char *URL
    );

Description

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.

Examples

    /* 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;
    }

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.