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

Ns_RegisterRequest

Overview

Register a function to handle HTTP requests for a method/URL combination

Syntax

    typedef void *Ns_OpContext;
    typedef void (Ns_OpProc) (void *context, Ns_Conn *conn);
    typedef void (Ns_OpDeleteProc) (void *context);
    
    void Ns_RegisterRequest(
    	char					*hServer,
    	char					*method,
    	char					*URL,
    	Ns_OpProc					*proc,
    	Ns_OpDeleteProc					*deleteProc,
    	Ns_OpContext		 			 context,
    	int					 flags
    );

Description

The Ns_RegisterRequest function registers function proc to handle HTTP requests. When the specified virtual server receives an HTTP request, it finds the most specific registered operation. The default operation for a GET (i.e., the one registered with URL `/') serves up a page out of the file system.

The virtual server passes your procedure the context you specify here and the Ns_Conn structure associated with the new HTTP connection.

When a procedure is unregistered with either Ns_UnRegisterRequest or by registering another procedure with the same method and URL, the server calls the deleteProc with the same context. You can use this to do any cleanup you might require (e.g., close an index file or free something from the heap). If the value of deleteProc is NULL, the server does nothing.

The flags parameter specifies one or more constants that can be OR'ed together. Currently, only the NS_OP_NOINHERIT and NS_OP_NODELETE flags can be set. NS_OP_NOINHERIT tells AOLserver to only call your procedure if the URL matches exactly (the default behavior is to look for the closest match). NS_OP_NODELETE specifies that the previous procedure's deleteproc should not be called. NS_OP_NODELETE can be used in conjunction with Ns_GetRequest to implement wrappers.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.