Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ns_setconnlocationproc(3aolserv) [debian man page]

Ns_Location(3aolserver) 				   AOLserver Library Procedures 				   Ns_Location(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_SetConnLocationProc, Ns_SetLocationProc - Set the location procedure to use SYNOPSIS
#include "ns.h" void Ns_SetConnLocationProc(Ns_LocationProc *procPtr) void Ns_SetLocationProc(char *ignored, Ns_LocationProc *procPtr) _________________________________________________________________ DESCRIPTION
These functions set the procedure to run when a call to Ns_ConnLocation is made. The location is defined in the form METHOD://HOST- NAME:PORT, e.g. http://myhost.com:8443. Setting the location procedure with these functions will cause all calls to Ns_ConnLocation to use the location procedure you define instead of using the location procedure callback in the communication module for the connection. There may be cases where you want to do this. For example, you could create a location procedure that reports on the values returned by communication module location procedure callbacks. At the end of that procedure, you could then return that value after logging the infor- mation making your location procedure is effectively transparent to the server and other modules. Ns_SetConnLocationProc(procPtr) Set the function to use when Ns_ConnLocation is called. This function is deprecated. Use Ns_SetLocationProc instead. Ns_SetLocationProc(ignored, procPtr) Set the function to use when Ns_ConnLocation is called. The ignored argument is reserved for future use. SEE ALSO
nsd(1), info(n), Ns_ConnLocation(3) KEYWORDS
AOLserver 4.0 Ns_Location(3aolserver)

Check Out this Related Man Page

Ns_UrlToFile(3aolserver)				   AOLserver Library Procedures 				  Ns_UrlToFile(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_SetUrlToFileProc, Ns_UrlIsDir, Ns_UrlIsFile, Ns_UrlToFile - URL to file mapping procedures SYNOPSIS
#include "ns.h" void Ns_SetUrlToFileProc(char *server, Ns_UrlToFileProc *procPtr) int Ns_UrlIsDir(char *server, char *url) int Ns_UrlIsFile(char *server, char *url) int Ns_UrlToFile(Ns_DString *dsPtr, char *server, char *url) _________________________________________________________________ DESCRIPTION
These functions map URL paths to real files and directories. They are normally used to determine whether a given URL has a corresponding file or directory and to return the real filesystem path that corresponds to the URL. Ns_SetUrlToFileProc(server, procPtr) Set a pointer to a custom routine to use in place of Ns_UrlToFile. Ns_UrlIsDir(server, url) Construct a directory name by appending the URL to the current AOLserver pages directory for the specified server. Return NS_TRUE if the directory exists; NS_FALSE otherwise. Ns_UrlIsFile(server, url) Construct a file name by appending the URL to the current AOLserver pages directory for the specified server. Return NS_TRUE if the file exists and is a regular file; NS_FALSE otherwise. Example: /* IsFile - Simple request to determine if an URL is a file. */ int IsFile(Ns_Conn *conn, void *ctx) { int isfile; char *server; server = Ns_ConnServer(conn); isfile = Ns_UrlIsFile(server, conn->request->url); if (isfile) { Ns_ConnReturnNotice(conn, 200, "File", NULL); } else { Ns_ConnReturnNotice(conn, 200, "Not a File", NULL); } return NS_OK; } Ns_UrlToFile(dsPtr, server, 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. Normally this prepends the pageroot to the URL path. If you have created your own custom routine and used Ns_SetUrlToFileProc to point to it, your routine is called instead. This could be used to create, for example, a module that takes the given URL and maps it to a file in a different way than the default Ns_UrlToFile routine. Example: /* 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; } SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_UrlToFile(3aolserver)
Man Page