/**
* Run the handler functions for each module
- * @param handler The handler string (a MIME type or a handler)
* @param r The request_rec
- * @deffunc void ap_run_handler(const char *handler,request_rec *r)
+ * @deffunc void ap_run_handler(request_rec *r)
* @tip non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
*/
-AP_DECLARE_HOOK(int,handler,(const char *handler,request_rec *r))
+AP_DECLARE_HOOK(int,handler,(request_rec *))
#ifdef __cplusplus
}
ap_hook_post_config
ap_hook_open_logs
ap_hook_child_init
+ ap_hook_handler
ap_get_status_table
ap_run_default_port
NULL, /* server config */
NULL, /* merge server config */
anon_auth_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
NULL, /* server config */
NULL, /* merge server config */
db_auth_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
NULL, /* server config */
NULL, /* merge server config */
dbm_auth_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
NULL, /* server config */
NULL, /* merge server config */
digest_cmds, /* command table */
- NULL, /* handlers */
register_hooks /* register hooks */
};
apr_status_t isapi_handler (request_rec *r)
{
- isapi_server_conf *sconf = ap_get_module_config(r->server->module_config,
- &isapi_module);
- apr_table_t *e = r->subprocess_env;
+ isapi_server_conf * sconf;
+ apr_table_t *e;
apr_status_t rv;
isapi_loaded *isa;
isapi_cid *cid;
DWORD read;
int res;
+ if(strcmp(r->handler, "isapi-isa"))
+ return DECLINED;
+
+ sconf = ap_get_module_config(r->server->module_config, &isapi_module);
+ e = r->subprocess_env;
+
/* Use similar restrictions as CGIs
*
* If this fails, it's pointless to load the isapi dll.
static void isapi_hooks(void)
{
ap_hook_post_config(isapi_post_config, NULL, NULL, AP_HOOK_MIDDLE);
+ ap_hook_handler(isapi_handler, NULL, NULL, AP_HOOK_MIDDLE);
}
static const command_rec isapi_cmds[] = {
{ NULL }
};
-handler_rec isapi_handlers[] = {
- { "isapi-isa", isapi_handler },
- { NULL}
-};
-
module isapi_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-dir config */
create_isapi_server_config, /* server config */
NULL, /* merge server config */
isapi_cmds, /* command apr_table_t */
- isapi_handlers, /* handlers */
isapi_hooks /* register hooks */
};
int errstatus;
int rc = OK;
+ if (strcmp(r->handler, "*.*")) {
+ return DECLINED;
+ }
+
/* we don't handle anything but GET */
if (r->method_number != M_GET) return DECLINED;
static void register_hooks(void)
{
+ ap_hook_handler(file_cache_handler, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_post_config(file_cache_post_config, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_translate_name(file_cache_xlat, NULL, NULL, AP_HOOK_MIDDLE);
/* This trick doesn't work apparently because the translate hooks
}
-static const handler_rec file_cache_handlers[] =
-{
- { "*/*", file_cache_handler },
- { NULL }
-};
-
module AP_MODULE_DECLARE_DATA file_cache_module =
{
STANDARD20_MODULE_STUFF,
create_server_config, /* create per-server config structure */
NULL, /* merge per-server config structures */
file_cache_cmds, /* command handlers */
- file_cache_handlers, /* handlers */
register_hooks /* register hooks */
};
dav_fs_create_server_config, /* server config */
dav_fs_merge_server_config, /* merge server config */
dav_fs_cmds, /* command table */
- NULL, /* handlers */
register_hooks, /* register hooks */
};
{
dav_dir_conf *conf;
+ if (strcmp(r->handler, "dav-handler")) {
+ return DECLINED;
+ }
+
/* quickly ignore any HTTP/0.9 requests */
if (r->assbackwards) {
return DECLINED;
static void register_hooks(void)
{
+ ap_hook_handler(dav_handler, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_post_config(dav_init_handler, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_type_checker(dav_type_checker, NULL, NULL, AP_HOOK_FIRST);
{ NULL }
};
-static const handler_rec dav_handlers[] =
-{
- {"dav-handler", dav_handler},
- { NULL }
-};
-
module DAV_DECLARE_DATA dav_module =
{
STANDARD20_MODULE_STUFF,
dav_create_server_config, /* server config */
dav_merge_server_config, /* merge server config */
dav_cmds, /* command table */
- dav_handlers, /* handlers */
register_hooks, /* register hooks */
};
#define ASIS_MAGIC_TYPE "httpd/send-as-is"
-static int asis_handler(const char *handler,request_rec *r)
+static int asis_handler(request_rec *r)
{
apr_file_t *f = NULL;
apr_status_t status;
const char *location;
apr_size_t nbytes;
- if(strcmp(handler,ASIS_MAGIC_TYPE) && strcmp(handler,"send-as-is"))
+ if(strcmp(r->handler,ASIS_MAGIC_TYPE) && strcmp(r->handler,"send-as-is"))
return DECLINED;
r->allowed |= (1 << M_GET);
/* The formal handler... */
-static int handle_autoindex(const char *handler,request_rec *r)
+static int handle_autoindex(request_rec *r)
{
autoindex_config_rec *d;
int allow_opts;
- if(strcmp(handler,DIR_MAGIC_TYPE))
+ if(strcmp(r->handler,DIR_MAGIC_TYPE))
return DECLINED;
allow_opts = ap_allow_options(r);
return APR_SUCCESS;
}
-static int cgi_handler(const char *handler, request_rec *r)
+static int cgi_handler(request_rec *r)
{
int retval, nph, dbpos = 0;
const char *argv0;
cgi_server_conf *conf;
apr_status_t rv;
- if(strcmp(handler,CGI_MAGIC_TYPE) && strcmp(handler,"cgi-script"))
+ if(strcmp(r->handler,CGI_MAGIC_TYPE) && strcmp(r->handler,"cgi-script"))
return DECLINED;
p = r->main ? r->main->pool : r->pool;
*
* Actual cgid handling...
*/
-static int cgid_handler(const char *handler, request_rec *r)
+static int cgid_handler(request_rec *r)
{
int retval, nph, dbpos = 0;
char *argv0, *dbuf = NULL;
apr_file_t *tempsock = NULL;
apr_size_t nbytes;
- if(strcmp(handler,CGI_MAGIC_TYPE) && strcmp(handler,"cgi-script"))
+ if(strcmp(r->handler,CGI_MAGIC_TYPE) && strcmp(r->handler,"cgi-script"))
return DECLINED;
if (r->method_number == M_OPTIONS) {
apr_array_header_t *server_status;
ap_status_table_row_t *status_rows;
+ if (strcmp(r->handler, STATUS_MAGIC_TYPE) && strcmp(r->handler, "server-status")) {
+ return DECLINED;
+ }
+
r->allowed = (1 << M_GET);
if (r->method_number != M_GET)
return DECLINED;
return 0;
}
-static const handler_rec status_handlers[] =
+static void register_hooks(void)
{
- {STATUS_MAGIC_TYPE, status_handler},
- {"server-status", status_handler},
- {NULL}
-};
+ ap_hook_handler(status_handler, NULL, NULL, AP_HOOK_MIDDLE);
+}
module AP_MODULE_DECLARE_DATA status_module =
{
NULL, /* server config */
NULL, /* merge server config */
NULL, /* command table */
- status_handlers, /* handlers */
- NULL /* register hooks */
+ register_hooks /* register hooks */
};
static int do_nothing(request_rec *r) { return OK; }
-static int default_handler(const char *handler, request_rec *r)
+static int default_handler(request_rec *r)
{
ap_bucket_brigade *bb;
ap_bucket *e;
* have a / in the middle, which probably captures the original
* intent, but may cause problems at first - Ben 7th Jan 01
*/
- if(strcmp(handler,"request-handler")
- && ap_strcmp_match(handler,"*/*"))
+ if(strcmp(r->handler,"default-handler")
+ && ap_strcmp_match(r->handler,"*/*"))
return DECLINED;
d = (core_dir_config *)ap_get_module_config(r->per_dir_config,
{NULL}
};
-static int action_handler(const char *handler,request_rec *r)
+static int action_handler(request_rec *r)
{
action_dir_config *conf = (action_dir_config *)
ap_get_module_config(r->per_dir_config, &action_module);
return new;
}
-static int handle_dir(const char *handler,request_rec *r)
+static int handle_dir(request_rec *r)
{
dir_config_rec *d;
char *dummy_ptr[1];
int num_names;
int error_notfound = 0;
- if(strcmp(handler,DIR_MAGIC_TYPE))
+ if(strcmp(r->handler,DIR_MAGIC_TYPE))
return DECLINED;
d = (dir_config_rec *) ap_get_module_config(r->per_dir_config,
ap_rputs("\n\n</body>\n</html>\n", r); /* finish the menu */
}
-static int imap_handler(const char *handler,request_rec *r)
+static int imap_handler(request_rec *r)
{
char input[MAX_STRING_LEN];
char *directive;
configfile_t *imap;
- if (r->method_number != M_GET || (strcmp(handler,IMAP_MAGIC_TYPE)
- && strcmp(handler, "imap-file")))
+ if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
+ && strcmp(r->handler, "imap-file")))
return DECLINED;
icr = ap_get_module_config(r->per_dir_config, &imap_module);
return OK;
}
-static int handle_map_file(const char *handler,request_rec *r)
+static int handle_map_file(request_rec *r)
{
negotiation_state *neg;
var_rec *best;
int res;
char *udir;
- if(strcmp(handler,MAP_FILE_MAGIC_TYPE) && strcmp(handler,"type-map"))
+ if(strcmp(r->handler,MAP_FILE_MAGIC_TYPE) && strcmp(r->handler,"type-map"))
return DECLINED;
neg = parse_accept_headers(r);
{ NULL }
};
- /* the apr_table_t of content handlers we provide */
-static const handler_rec handler_table[] = {
- { "redirect-handler", handler_redirect },
- { NULL }
-};
-
static void register_hooks(void)
{
+ ap_hook_handler(handler_redirect, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_post_config(init_module,NULL,NULL,AP_HOOK_MIDDLE);
ap_hook_child_init(init_child,NULL,NULL,AP_HOOK_MIDDLE);
config_server_create, /* create per-server config structures */
config_server_merge, /* merge per-server config structures */
command_table, /* apr_table_t of config file commands */
- handler_table, /* [#8] MIME-typed-dispatched handlers */
register_hooks /* register hooks */
};
static int handler_redirect(request_rec *r)
{
+ if (strcmp(r->handler, "redirect-handler")) {
+ return DECLINED;
+ }
+
/* just make sure that we are really meant! */
if (strncmp(r->filename, "redirect:", 9) != 0) {
return DECLINED;
so_sconf_create, /* server config */
NULL, /* merge server config */
so_cmds, /* command apr_table_t */
- NULL, /* handlers */
NULL /* register hooks */
};
create_mconfig_for_server, /* server config */
NULL, /* merge server config */
speling_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
NULL, /* server config */
NULL, /* merge server configs */
cern_meta_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
NULL, /* server config */
NULL, /* merge server configs */
expires_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
create_headers_config, /* server config */
merge_headers_config, /* merge server configs */
headers_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
make_cookie_log_state, /* server config */
NULL, /* merge server configs */
cookie_log_cmds, /* command apr_table_t */
- NULL, /* handlers */
register_hooks /* register hooks */
};
apr_status_t isapi_handler (request_rec *r)
{
- isapi_server_conf *sconf = ap_get_module_config(r->server->module_config,
- &isapi_module);
- apr_table_t *e = r->subprocess_env;
+ isapi_server_conf * sconf;
+ apr_table_t *e;
apr_status_t rv;
isapi_loaded *isa;
isapi_cid *cid;
DWORD read;
int res;
+ if(strcmp(r->handler, "isapi-isa"))
+ return DECLINED;
+
+ sconf = ap_get_module_config(r->server->module_config, &isapi_module);
+ e = r->subprocess_env;
+
/* Use similar restrictions as CGIs
*
* If this fails, it's pointless to load the isapi dll.
static void isapi_hooks(void)
{
ap_hook_post_config(isapi_post_config, NULL, NULL, AP_HOOK_MIDDLE);
+ ap_hook_handler(isapi_handler, NULL, NULL, AP_HOOK_MIDDLE);
}
static const command_rec isapi_cmds[] = {
{ NULL }
};
-handler_rec isapi_handlers[] = {
- { "isapi-isa", isapi_handler },
- { NULL}
-};
-
module isapi_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-dir config */
create_isapi_server_config, /* server config */
NULL, /* merge server config */
isapi_cmds, /* command apr_table_t */
- isapi_handlers, /* handlers */
isapi_hooks /* register hooks */
};
AP_IMPLEMENT_HOOK_VOID(child_init,
(apr_pool_t *pchild, server_rec *s),(pchild,s))
-AP_IMPLEMENT_HOOK_RUN_FIRST(int,handler,(const char *handler,request_rec *r),
- (handler,r),DECLINED)
+AP_IMPLEMENT_HOOK_RUN_FIRST(int,handler,(request_rec *r),
+ (r),DECLINED)
/****************************************************************
*
char *p2;
int result;
char hbuf[MAX_STRING_LEN];
+ const char *old_handler = r->handler;
- if (r->handler) {
- handler = r->handler;
- }
- else {
+ if (!r->handler) {
handler = r->content_type ? r->content_type : ap_default_type(r);
if ((p=ap_strchr_c(handler, ';')) != NULL) {
apr_cpystrn(hbuf, handler, sizeof hbuf);
--p2; /* strip trailing spaces */
*p2='\0';
}
+ r->handler = handler;
}
- result = ap_run_handler(handler ,r);
+ result = ap_run_handler(r);
+
+ r->handler = old_handler;
if (result == DECLINED && r->handler && r->filename) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
NULL, /* create per-server config structure */
NULL, /* merge per-server config structures */
winnt_cmds, /* command apr_table_t */
- NULL, /* handlers */
winnt_hooks /* register_hooks */
};