Data Structures | |
struct | _HTTP_CGI_FUNCTION |
Common gateway interface function entry structure. More... | |
Typedefs | |
typedef struct _HTTP_CGI_FUNCTION | HTTP_CGI_FUNCTION |
Common gateway interface function entry type. | |
typedef int(* | HTTP_CGI_HANDLER )(HTTPD_SESSION *) |
Functions | |
int | HttpRegisterCgiFunction (const char *uri, HTTP_CGI_HANDLER handler) |
Register a common gateway interface function. | |
int | HttpCgiFunctionHandler (HTTPD_SESSION *hs, const MEDIA_TYPE_ENTRY *mt, const char *filepath) |
Default media type handler for CGI functions. |
$Id$
typedef struct _HTTP_CGI_FUNCTION HTTP_CGI_FUNCTION |
Common gateway interface function entry type.
typedef int(* HTTP_CGI_HANDLER)(HTTPD_SESSION *) |
int HttpRegisterCgiFunction | ( | const char * | uri, |
HTTP_CGI_HANDLER | handler | ||
) |
Register a common gateway interface function.
Usage example:
#include <pro/uhttp/modules/mod_cgi_func.h> int CgiTest(HTTPD_SESSION *hs, const HTTP_CGI_FUNCTION *cgi) { ... return 0 } if (HttpRegisterCgiFunction("cgi/test.cgi", CgiTest) == 0) { puts("CGI registered."); ... } else { puts("Failed to register CGI."); ... } if (HttpRegisterCgiFunction("cgi/test.cgi", NULL) == 0) { puts("CGI unregistered."); ... } else { puts("Failed to unregister CGI."); ... } if (HttpRegisterMediaType("cgi", NULL, NULL, HttpCgiFunctionHandler) == 0) { puts("Media type CGI registered."); ... } else { puts("Failed to register CGI media type."); ... }
uri | Case insensitive URI of this CGI. Previously registered functions may be overridden by subsequent calls using the same URI. |
handler | Pointer to the function that will be called if the given URI is requested, or NULL to unregister the CGI function. |
References calloc, _HTTP_CGI_FUNCTION::cgi_handler, _HTTP_CGI_FUNCTION::cgi_uri, cgiFunctionList, free(), HTTP_ASSERT, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_INSERTBEFORE, ISC_LIST_NEXT, ISC_LIST_UNLINK_TYPE, NULL, rc, strcasecmp, and strdup().
int HttpCgiFunctionHandler | ( | HTTPD_SESSION * | hs, |
const MEDIA_TYPE_ENTRY * | mt, | ||
const char * | filepath | ||
) |
Default media type handler for CGI functions.
References _HTTP_CGI_FUNCTION::cgi_handler, HTTP_ASSERT, HTTP_ROOT, NULL, strlen(), and strncasecmp.
Referenced by HttpSsiExecHandler().