httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: httpd-2.0/server/mpm/prefork prefork.c
Date Sun, 07 Jan 2001 19:55:59 GMT
ben         01/01/07 11:55:59

  Modified:    include  http_config.h
               modules/aaa mod_access.c mod_auth.c
               modules/experimental mod_generic_hook_export.c
                        mod_generic_hook_import.c
               modules/filters mod_include.c
               modules/generators mod_asis.c mod_autoindex.c mod_cgi.c
                        mod_cgid.c
               modules/http http_core.c mod_mime.c
               modules/loggers mod_log_config.c
               modules/mappers mod_actions.c mod_alias.c mod_dir.c
                        mod_imap.c mod_negotiation.c mod_userdir.c
               modules/metadata mod_env.c mod_setenvif.c
               server   config.c
               server/mpm/mpmt_pthread mpmt_pthread.c
               server/mpm/prefork prefork.c
  Log:
  Make handlers use hooks.
  
  Revision  Changes    Path
  1.53      +9 -17     httpd-2.0/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_config.h,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- http_config.h	2000/12/19 17:05:12	1.52
  +++ http_config.h	2001/01/07 19:55:55	1.53
  @@ -317,20 +317,6 @@
       const ap_directive_t *err_directive;
   };
   
  -typedef struct handler_rec handler_rec;
  -
  -/** This structure records the existence of handlers in a module... */
  -struct handler_rec {
  -    /** The type of content this handler function will handle.  
  -     *  MUST be all lower case 
  -     */
  -    const char *content_type;
  -    /** The function to call when this context-type is requested. 
  -     *  @deffunc int handler(request_rec *)
  -     */
  -    int (*handler) (request_rec *);
  -};
  -
   typedef struct module_struct module;
   /**
    * Module structures.  Just about everything is dispatched through
  @@ -405,9 +391,6 @@
       /** A command_rec table that describes all of the directives this module
        * defines. */
       const command_rec *cmds;
  -    /** A handler_rec table that describes all of the mime-types this module
  -     *  will server responses for. */
  -    const handler_rec *handlers;
   
       /** A hook to allow modules to hook other points in the request processing.
        *  In this function, modules should call the ap_hook_*() functions to
  @@ -1007,6 +990,15 @@
    * @deffunc void ap_run_child_init(apr_pool_t *pchild, server_rec *s)
    */
   AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
  +
  +/**
  + * 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)
  + * @tip non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
  + */
  +AP_DECLARE_HOOK(int,handler,(const char *handler,request_rec *r))
   
   #ifdef __cplusplus
   }
  
  
  
  1.23      +0 -1      httpd-2.0/modules/aaa/mod_access.c
  
  Index: mod_access.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_access.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_access.c	2000/12/14 18:47:22	1.22
  +++ mod_access.c	2001/01/07 19:55:55	1.23
  @@ -419,6 +419,5 @@
       NULL,			/* server config */
       NULL,			/* merge server config */
       access_cmds,
  -    NULL,			/* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.25      +0 -1      httpd-2.0/modules/aaa/mod_auth.c
  
  Index: mod_auth.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_auth.c	2000/10/16 06:05:04	1.24
  +++ mod_auth.c	2001/01/07 19:55:55	1.25
  @@ -332,6 +332,5 @@
       NULL,			/* server config */
       NULL,			/* merge server config */
       auth_cmds,			/* command apr_table_t */
  -    NULL,			/* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.2       +0 -1      httpd-2.0/modules/experimental/mod_generic_hook_export.c
  
  Index: mod_generic_hook_export.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_generic_hook_export.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_generic_hook_export.c	2001/01/02 17:41:34	1.1
  +++ mod_generic_hook_export.c	2001/01/07 19:55:56	1.2
  @@ -78,6 +78,5 @@
       NULL,
       NULL,
       NULL,
  -    NULL,
       ExportRegisterHooks
   };
  
  
  
  1.2       +0 -1      httpd-2.0/modules/experimental/mod_generic_hook_import.c
  
  Index: mod_generic_hook_import.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_generic_hook_import.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_generic_hook_import.c	2001/01/02 17:41:34	1.1
  +++ mod_generic_hook_import.c	2001/01/07 19:55:56	1.2
  @@ -79,6 +79,5 @@
       NULL,
       NULL,
       NULL,
  -    NULL,
       ImportRegisterHooks
   };
  
  
  
  1.84      +0 -1      httpd-2.0/modules/filters/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- mod_include.c	2001/01/04 20:45:06	1.83
  +++ mod_include.c	2001/01/07 19:55:56	1.84
  @@ -3079,6 +3079,5 @@
       NULL,                       /* server config */
       NULL,                       /* merge server config */
       includes_cmds,              /* command apr_table_t */
  -    NULL,                       /* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.27      +8 -8      httpd-2.0/modules/generators/mod_asis.c
  
  Index: mod_asis.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_asis.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_asis.c	2000/10/16 06:05:04	1.26
  +++ mod_asis.c	2001/01/07 19:55:56	1.27
  @@ -68,13 +68,16 @@
   
   #define ASIS_MAGIC_TYPE "httpd/send-as-is"
   
  -static int asis_handler(request_rec *r)
  +static int asis_handler(const char *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"))
  +	return DECLINED;
  +
       r->allowed |= (1 << M_GET);
       if (r->method_number != M_GET)
   	return DECLINED;
  @@ -121,12 +124,10 @@
       return OK;
   }
   
  -static const handler_rec asis_handlers[] =
  +static void register_hooks(void)
   {
  -    {ASIS_MAGIC_TYPE, asis_handler},
  -    {"send-as-is", asis_handler},
  -    {NULL}
  -};
  +    ap_hook_handler(asis_handler,NULL,NULL,AP_HOOK_MIDDLE);
  +}
   
   module AP_MODULE_DECLARE_DATA asis_module =
   {
  @@ -136,6 +137,5 @@
       NULL,			/* create per-server config structure */
       NULL,			/* merge per-server config structures */
       NULL,			/* command apr_table_t */
  -    asis_handlers,		/* handlers */
  -    NULL			/* register hooks */
  +    register_hooks		/* register hooks */
   };
  
  
  
  1.50      +11 -9     httpd-2.0/modules/generators/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- mod_autoindex.c	2001/01/05 19:40:02	1.49
  +++ mod_autoindex.c	2001/01/07 19:55:56	1.50
  @@ -1660,11 +1660,16 @@
   
   /* The formal handler... */
   
  -static int handle_autoindex(request_rec *r)
  +static int handle_autoindex(const char *handler,request_rec *r)
   {
       autoindex_config_rec *d;
  -    int allow_opts = ap_allow_options(r);
  +    int allow_opts;
   
  +    if(strcmp(handler,DIR_MAGIC_TYPE))
  +	return DECLINED;
  +
  +    allow_opts = ap_allow_options(r);
  +
       d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config,
   						      &autoindex_module);
   
  @@ -1693,12 +1698,10 @@
       }
   }
   
  -
  -static const handler_rec autoindex_handlers[] =
  +static void register_hooks(void)
   {
  -    {DIR_MAGIC_TYPE, handle_autoindex},
  -    {NULL}
  -};
  +    ap_hook_handler(handle_autoindex,NULL,NULL,AP_HOOK_MIDDLE);
  +}
   
   module AP_MODULE_DECLARE_DATA autoindex_module =
   {
  @@ -1708,6 +1711,5 @@
       NULL,			/* server config */
       NULL,			/* merge server config */
       autoindex_cmds,		/* command apr_table_t */
  -    autoindex_handlers,		/* handlers */
  -    NULL			/* register hooks */
  +    register_hooks		/* register hooks */
   };
  
  
  
  1.76      +8 -8      httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- mod_cgi.c	2001/01/03 20:03:48	1.75
  +++ mod_cgi.c	2001/01/07 19:55:56	1.76
  @@ -498,7 +498,7 @@
       return APR_SUCCESS;
   }
   
  -static int cgi_handler(request_rec *r)
  +static int cgi_handler(const char *handler, request_rec *r)
   {
       int retval, nph, dbpos = 0;
       const char *argv0;
  @@ -514,6 +514,9 @@
       cgi_server_conf *conf;
       apr_status_t rv;
   
  +    if(strcmp(handler,CGI_MAGIC_TYPE) && strcmp(handler,"cgi-script"))
  +	return DECLINED;
  +
       p = r->main ? r->main->pool : r->pool;
   
       if (r->method_number == M_OPTIONS) {
  @@ -717,12 +720,10 @@
       return OK;			/* NOT r->status, even if it has changed. */
   }
   
  -static const handler_rec cgi_handlers[] =
  +static void register_hooks(void)
   {
  -    {CGI_MAGIC_TYPE, cgi_handler},
  -    {"cgi-script", cgi_handler},
  -    {NULL}
  -};
  +    ap_hook_handler(cgi_handler, NULL, NULL, AP_HOOK_MIDDLE);
  +}
   
   module AP_MODULE_DECLARE_DATA cgi_module =
   {
  @@ -732,6 +733,5 @@
       create_cgi_config,		/* server config */
       merge_cgi_config,		/* merge server config */
       cgi_cmds,			/* command apr_table_t */
  -    cgi_handlers,		/* handlers */
  -    NULL			/* register hooks */
  +    register_hooks		/* register hooks */
   };
  
  
  
  1.58      +12 -12    httpd-2.0/modules/generators/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- mod_cgid.c	2001/01/03 20:03:48	1.57
  +++ mod_cgid.c	2001/01/07 19:55:56	1.58
  @@ -730,22 +730,25 @@
    * 
    * Actual cgid handling... 
    */ 
  -static int cgid_handler(request_rec *r) 
  +static int cgid_handler(const char *handler, request_rec *r) 
   { 
       int retval, nph, dbpos = 0; 
       char *argv0, *dbuf = NULL; 
       ap_bucket_brigade *bb;
       ap_bucket *b;
       char argsbuffer[HUGE_STRING_LEN]; 
  -    void *sconf = r->server->module_config; 
  -    cgid_server_conf *conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module);

  -    int is_included = !strcmp(r->protocol, "INCLUDED"); 
  +    void *sconf;
  +    cgid_server_conf *conf;
  +    int is_included;
       int sd;
       char **env; 
       struct sockaddr_un unix_addr;
       apr_file_t *tempsock = NULL;
       apr_size_t nbytes;
   
  +    if(strcmp(handler,CGI_MAGIC_TYPE) && strcmp(handler,"cgi-script"))
  +	return DECLINED;
  +
       if (r->method_number == M_OPTIONS) { 
           /* 99 out of 100 cgid scripts, this is all they support */ 
           r->allowed |= (1 << M_GET); 
  @@ -753,6 +756,10 @@
           return DECLINED; 
       } 
   
  +    sconf = r->server->module_config; 
  +    conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module); 
  +    is_included = !strcmp(r->protocol, "INCLUDED"); 
  +
       if ((argv0 = strrchr(r->filename, '/')) != NULL)
           argv0++;
       else
  @@ -924,16 +931,10 @@
       return OK; /* NOT r->status, even if it has changed. */ 
   } 
   
  -static const handler_rec cgid_handlers[] = 
  -{ 
  -    {CGI_MAGIC_TYPE, cgid_handler}, 
  -    {"cgi-script", cgid_handler}, 
  -    {NULL} 
  -};
  -
   static void register_hook(void)
   {
       ap_hook_post_config(cgid_init, NULL, NULL, AP_HOOK_MIDDLE);
  +    ap_hook_handler(cgid_handler, NULL, NULL, AP_HOOK_MIDDLE);
   }
   
   module AP_MODULE_DECLARE_DATA cgid_module = { 
  @@ -943,7 +944,6 @@
       create_cgid_config, /* server config */ 
       merge_cgid_config, /* merge server config */ 
       cgid_cmds, /* command table */ 
  -    cgid_handlers, /* handlers */ 
       register_hook /* register_handlers */ 
   }; 
   
  
  
  
  1.235     +19 -12    httpd-2.0/modules/http/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v
  retrieving revision 1.234
  retrieving revision 1.235
  diff -u -r1.234 -r1.235
  --- http_core.c	2001/01/05 20:44:41	1.234
  +++ http_core.c	2001/01/07 19:55:57	1.235
  @@ -2971,12 +2971,11 @@
   
   static int do_nothing(request_rec *r) { return OK; }
   
  -static int default_handler(request_rec *r)
  +static int default_handler(const char *handler, request_rec *r)
   {
       ap_bucket_brigade *bb;
       ap_bucket *e;
  -    core_dir_config *d =
  -	    (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
  +    core_dir_config *d;
       int errstatus;
       apr_file_t *fd = NULL;
       apr_status_t status;
  @@ -2987,9 +2986,23 @@
        *     support fairly closely (unlike 1.3, we don't handle computing md5
        *     when the charset is translated).
        */
  -    int bld_content_md5 = 
  -        (d->content_md5 & 1) && r->output_filters->frec->ftype
!= AP_FTYPE_CONTENT;
  +    int bld_content_md5;
   
  +    /*
  +     * The old way of doing handlers meant that this handler would
  +     * match literally anything - this way will require handler to
  +     * 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,"*/*"))
  +	return DECLINED;
  +
  +    d = (core_dir_config *)ap_get_module_config(r->per_dir_config,
  +						&core_module);
  +    bld_content_md5 = (d->content_md5 & 1)
  +      && r->output_filters->frec->ftype != AP_FTYPE_CONTENT;
  +
       ap_allow_methods(r, MERGE_ALLOW, "GET", "OPTIONS", "POST", NULL);
   
       if ((errstatus = ap_discard_request_body(r)) != OK) {
  @@ -3488,12 +3501,6 @@
       return APR_SUCCESS;
   }
   
  -static const handler_rec core_handlers[] = {
  -{ "*/*", default_handler },
  -{ "default-handler", default_handler },
  -{ NULL, NULL }
  -};
  -
   static void core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
   {
       ap_init_bucket_types(pconf);
  @@ -3547,6 +3554,7 @@
       ap_hook_http_method(core_method,NULL,NULL,AP_HOOK_REALLY_LAST);
       ap_hook_default_port(core_port,NULL,NULL,AP_HOOK_REALLY_LAST);
       ap_hook_open_logs(core_open_logs,NULL,NULL,AP_HOOK_MIDDLE);
  +    ap_hook_handler(default_handler,NULL,NULL,AP_HOOK_REALLY_LAST);
       /* FIXME: I suspect we can eliminate the need for these - Ben */
       ap_hook_type_checker(do_nothing,NULL,NULL,AP_HOOK_REALLY_LAST);
       ap_hook_access_checker(do_nothing,NULL,NULL,AP_HOOK_REALLY_LAST);
  @@ -3579,6 +3587,5 @@
       create_core_server_config,	/* create per-server config structure */
       merge_core_server_configs,	/* merge per-server config structures */
       core_cmds,			/* command apr_table_t */
  -    core_handlers,		/* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.32      +0 -1      httpd-2.0/modules/http/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/mod_mime.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- mod_mime.c	2000/11/20 18:29:55	1.31
  +++ mod_mime.c	2001/01/07 19:55:57	1.32
  @@ -854,6 +854,5 @@
       NULL,			/* create per-server config structure */
       NULL,			/* merge per-server config structures */
       mime_cmds,			/* command apr_table_t */
  -    NULL,			/* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.43      +0 -1      httpd-2.0/modules/loggers/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/mod_log_config.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- mod_log_config.c	2000/11/30 00:31:03	1.42
  +++ mod_log_config.c	2001/01/07 19:55:57	1.43
  @@ -1256,6 +1256,5 @@
       make_config_log_state,      /* server config */
       merge_config_log_state,     /* merge server config */
       config_log_cmds,            /* command apr_table_t */
  -    NULL,                       /* handlers */
       register_hooks              /* register hooks */
   };
  
  
  
  1.16      +7 -7      httpd-2.0/modules/mappers/mod_actions.c
  
  Index: mod_actions.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_actions.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_actions.c	2000/11/29 19:39:17	1.15
  +++ mod_actions.c	2001/01/07 19:55:57	1.16
  @@ -158,7 +158,7 @@
       {NULL}
   };
   
  -static int action_handler(request_rec *r)
  +static int action_handler(const char *handler,request_rec *r)
   {
       action_dir_config *conf = (action_dir_config *)
           ap_get_module_config(r->per_dir_config, &action_module);
  @@ -167,6 +167,8 @@
       const char *script;
       int i;
   
  +    /* Note that this handler handles _all_ types, so handler is unchecked */
  +
       /* Set allowed stuff */
       for (i = 0; i < METHODS; ++i) {
           if (conf->scripted[i])
  @@ -207,11 +209,10 @@
       return OK;
   }
   
  -static const handler_rec action_handlers[] =
  +static void register_hooks(void)
   {
  -    {"*/*", action_handler},
  -    {NULL}
  -};
  +    ap_hook_handler(action_handler,NULL,NULL,AP_HOOK_LAST);
  +}
   
   module action_module =
   {
  @@ -221,6 +222,5 @@
       NULL,			/* server config */
       NULL,			/* merge server config */
       action_cmds,		/* command apr_table_t */
  -    action_handlers,		/* handlers */
  -    NULL			/* register hooks */
  +    register_hooks		/* register hooks */
   };
  
  
  
  1.20      +0 -1      httpd-2.0/modules/mappers/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_alias.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_alias.c	2000/11/10 01:12:10	1.19
  +++ mod_alias.c	2001/01/07 19:55:57	1.20
  @@ -436,6 +436,5 @@
       create_alias_config,	/* server config */
       merge_alias_config,		/* merge server configs */
       alias_cmds,			/* command apr_table_t */
  -    NULL,			/* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.23      +14 -10    httpd-2.0/modules/mappers/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_dir.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_dir.c	2000/11/23 13:03:39	1.22
  +++ mod_dir.c	2001/01/07 19:55:57	1.23
  @@ -116,16 +116,20 @@
       return new;
   }
   
  -static int handle_dir(request_rec *r)
  +static int handle_dir(const char *handler,request_rec *r)
   {
  -    dir_config_rec *d =
  -    (dir_config_rec *) ap_get_module_config(r->per_dir_config,
  -                                         &dir_module);
  +    dir_config_rec *d;
       char *dummy_ptr[1];
       char **names_ptr;
       int num_names;
       int error_notfound = 0;
   
  +    if(strcmp(handler,DIR_MAGIC_TYPE))
  +	return DECLINED;
  +
  +    d = (dir_config_rec *) ap_get_module_config(r->per_dir_config,
  +						&dir_module);
  +
       if (r->uri[0] == '\0' || r->uri[strlen(r->uri) - 1] != '/') {
           char *ifile;
           if (r->args != NULL)
  @@ -218,11 +222,12 @@
   }
   
   
  -static const handler_rec dir_handlers[] =
  +static void register_hooks(void)
   {
  -    {DIR_MAGIC_TYPE, handle_dir},
  -    {NULL}
  -};
  +    static const char * const aszSucc[]={ "mod_autoindex.c", NULL };
  +
  +    ap_hook_handler(handle_dir,NULL,aszSucc,AP_HOOK_MIDDLE);
  +}
   
   module AP_MODULE_DECLARE_DATA dir_module = {
       STANDARD20_MODULE_STUFF,
  @@ -231,6 +236,5 @@
       NULL,			/* create per-server config structure */
       NULL,			/* merge per-server config structures */
       dir_cmds,			/* command apr_table_t */
  -    dir_handlers,		/* handlers */
  -    NULL			/* register hooks */
  +    register_hooks		/* register hooks */
   };
  
  
  
  1.24      +18 -16    httpd-2.0/modules/mappers/mod_imap.c
  
  Index: mod_imap.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_imap.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- mod_imap.c	2000/11/26 04:47:36	1.23
  +++ mod_imap.c	2001/01/07 19:55:57	1.24
  @@ -612,7 +612,7 @@
       ap_rputs("\n\n</body>\n</html>\n", r);         /* finish the menu */
   }
   
  -static int imap_handler(request_rec *r)
  +static int imap_handler(const char *handler,request_rec *r)
   {
       char input[MAX_STRING_LEN];
       char *directive;
  @@ -632,18 +632,24 @@
       char *string_pos;
       int showmenu = 0;
   
  -    imap_conf_rec *icr = ap_get_module_config(r->per_dir_config, &imap_module);
  +    imap_conf_rec *icr;
   
  -    char *imap_menu = icr->imap_menu ? icr->imap_menu : IMAP_MENU_DEFAULT;
  -    char *imap_default = icr->imap_default
  -			    ?  icr->imap_default : IMAP_DEFAULT_DEFAULT;
  -    char *imap_base = icr->imap_base ? icr->imap_base : IMAP_BASE_DEFAULT;
  +    char *imap_menu;
  +    char *imap_default;
  +    char *imap_base;
   
       configfile_t *imap; 
   
  -    if (r->method_number != M_GET) {
  +    if (r->method_number != M_GET || (strcmp(handler,IMAP_MAGIC_TYPE)
  +				      && strcmp(handler, "imap-file")))
   	return DECLINED;
  -    }
  +
  +    icr = ap_get_module_config(r->per_dir_config, &imap_module);
  +
  +    imap_menu = icr->imap_menu ? icr->imap_menu : IMAP_MENU_DEFAULT;
  +    imap_default = icr->imap_default
  +      ?  icr->imap_default : IMAP_DEFAULT_DEFAULT;
  +    imap_base = icr->imap_base ? icr->imap_base : IMAP_BASE_DEFAULT;
   
       status = ap_pcfg_openfile(&imap, r->pool, r->filename);
   
  @@ -907,13 +913,10 @@
       return HTTP_INTERNAL_SERVER_ERROR;
   }
   
  -
  -static const handler_rec imap_handlers[] =
  +static void register_hooks(void)
   {
  -    {IMAP_MAGIC_TYPE, imap_handler},
  -    {"imap-file", imap_handler},
  -    {NULL}
  -};
  +    ap_hook_handler(imap_handler,NULL,NULL,AP_HOOK_MIDDLE);
  +}
   
   module AP_MODULE_DECLARE_DATA imap_module =
   {
  @@ -923,6 +926,5 @@
       NULL,                       /* server config */
       NULL,                       /* merge server config */
       imap_cmds,                  /* command apr_table_t */
  -    imap_handlers,              /* handlers */
  -    NULL                        /* register hooks */
  +    register_hooks              /* register hooks */
   };
  
  
  
  1.45      +7 -11     httpd-2.0/modules/mappers/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_negotiation.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- mod_negotiation.c	2001/01/05 19:40:02	1.44
  +++ mod_negotiation.c	2001/01/07 19:55:57	1.45
  @@ -2566,14 +2566,17 @@
       return OK;
   }
   
  -static int handle_map_file(request_rec *r)
  +static int handle_map_file(const char *handler,request_rec *r)
   {
  -    negotiation_state *neg = parse_accept_headers(r);
  +    negotiation_state *neg;
       var_rec *best;
       int res;
  -
       char *udir;
   
  +    if(strcmp(handler,MAP_FILE_MAGIC_TYPE) && strcmp(handler,"type-map"))
  +	return DECLINED;
  +
  +    neg = parse_accept_headers(r);
       if ((res = read_type_map(neg, r))) {
           return res;
       }
  @@ -2742,17 +2745,11 @@
       return DECLINED;
   }
   
  -static const handler_rec negotiation_handlers[] =
  -{
  -    {MAP_FILE_MAGIC_TYPE, handle_map_file},
  -    {"type-map", handle_map_file},
  -    {NULL}
  -};
  -
   static void register_hooks(void)
   {
       ap_hook_fixups(fix_encoding,NULL,NULL,AP_HOOK_MIDDLE);
       ap_hook_type_checker(handle_multi,NULL,NULL,AP_HOOK_FIRST);
  +    ap_hook_handler(handle_map_file,NULL,NULL,AP_HOOK_MIDDLE);
   }
   
   module AP_MODULE_DECLARE_DATA negotiation_module =
  @@ -2763,6 +2760,5 @@
       NULL,                       /* server config */
       NULL,                       /* merge server config */
       negotiation_cmds,           /* command apr_table_t */
  -    negotiation_handlers,       /* handlers */
       register_hooks              /* register hooks */
   };
  
  
  
  1.28      +0 -1      httpd-2.0/modules/mappers/mod_userdir.c
  
  Index: mod_userdir.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_userdir.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- mod_userdir.c	2000/11/13 03:18:18	1.27
  +++ mod_userdir.c	2001/01/07 19:55:58	1.28
  @@ -401,6 +401,5 @@
       create_userdir_config,      /* server config */
       NULL,                       /* merge server config */
       userdir_cmds,               /* command apr_table_t */
  -    NULL,                       /* handlers */
       register_hooks              /* register hooks */
   };
  
  
  
  1.17      +0 -1      httpd-2.0/modules/metadata/mod_env.c
  
  Index: mod_env.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_env.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_env.c	2000/10/16 06:05:05	1.16
  +++ mod_env.c	2001/01/07 19:55:58	1.17
  @@ -268,6 +268,5 @@
       NULL,                       /* server config */
       NULL,                       /* merge server configs */
       env_module_cmds,            /* command apr_table_t */
  -    NULL,                       /* handlers */
       register_hooks              /* register hooks */
   };
  
  
  
  1.20      +0 -1      httpd-2.0/modules/metadata/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_setenvif.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_setenvif.c	2000/10/16 06:05:07	1.19
  +++ mod_setenvif.c	2001/01/07 19:55:58	1.20
  @@ -466,6 +466,5 @@
       create_setenvif_config_svr, /* server config */
       merge_setenvif_config,      /* merge server configs */
       setenvif_module_cmds,       /* command apr_table_t */
  -    NULL,                       /* handlers */
       register_hooks		/* register hooks */
   };
  
  
  
  1.94      +12 -91    httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- config.c	2001/01/05 20:44:43	1.93
  +++ config.c	2001/01/07 19:55:58	1.94
  @@ -110,11 +110,12 @@
   AP_DECLARE_DATA ap_directive_t *ap_conftree;
   
   AP_HOOK_STRUCT(
  -	    AP_HOOK_LINK(header_parser)
  -	    AP_HOOK_LINK(pre_config)
  -	    AP_HOOK_LINK(post_config)
  -	    AP_HOOK_LINK(open_logs)
  -	    AP_HOOK_LINK(child_init)
  +	       AP_HOOK_LINK(header_parser)
  +	       AP_HOOK_LINK(pre_config)
  +	       AP_HOOK_LINK(post_config)
  +	       AP_HOOK_LINK(open_logs)
  +	       AP_HOOK_LINK(child_init)
  +	       AP_HOOK_LINK(handler)
   )
   
   AP_IMPLEMENT_HOOK_RUN_ALL(int,header_parser,
  @@ -131,6 +132,9 @@
   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)
  +
   /****************************************************************
    *
    * We begin with the functions which deal with the linked list
  @@ -272,68 +276,8 @@
       return create_empty_config(p);
   }
   
  -/*
  - * For speed/efficiency we generate a compact list of all the handlers
  - * and wildcard handlers.  This means we won't have to scan the entire
  - * module list looking for handlers... where we'll find a whole whack
  - * of NULLs.
  - */
  -typedef struct {
  -    handler_rec hr;
  -    size_t len;
  -} fast_handler_rec;
  -
  -static fast_handler_rec *handlers;
  -static fast_handler_rec *wildhandlers;
  -
  -static void init_handlers(apr_pool_t *p)
  -{
  -    module *modp;
  -    int nhandlers = 0;
  -    int nwildhandlers = 0;
  -    const handler_rec *handp;
  -    fast_handler_rec *ph, *pw;
  -    const char *starp;
  -
  -    for (modp = top_module; modp; modp = modp->next) {
  -	if (!modp->handlers)
  -	    continue;
  -	for (handp = modp->handlers; handp->content_type; ++handp) {
  -	    if (ap_strchr_c(handp->content_type, '*')) {
  -                nwildhandlers ++;
  -            } else {
  -                nhandlers ++;
  -            }
  -        }
  -    }
  -    ph = handlers = apr_palloc(p, sizeof(*ph)*(nhandlers + 1));
  -    pw = wildhandlers = apr_palloc(p, sizeof(*pw)*(nwildhandlers + 1));
  -    for (modp = top_module; modp; modp = modp->next) {
  -	if (!modp->handlers)
  -	    continue;
  -	for (handp = modp->handlers; handp->content_type; ++handp) {
  -	    if ((starp = ap_strchr_c(handp->content_type, '*'))) {
  -                pw->hr.content_type = handp->content_type;
  -                pw->hr.handler = handp->handler;
  -		pw->len = starp - handp->content_type;
  -                pw ++;
  -            } else {
  -                ph->hr.content_type = handp->content_type;
  -                ph->hr.handler = handp->handler;
  -		ph->len = strlen(handp->content_type);
  -                ph ++;
  -            }
  -        }
  -    }
  -    pw->hr.content_type = NULL;
  -    pw->hr.handler = NULL;
  -    ph->hr.content_type = NULL;
  -    ph->hr.handler = NULL;
  -}
  -
   int ap_invoke_handler(request_rec *r)
   {
  -    fast_handler_rec *handp;
       const char *handler;
       const char *p;
       size_t handler_len;
  @@ -355,36 +299,14 @@
   	    handler_len = strlen(handler);
   	}
       }
  -
  -    /* Pass one --- direct matches */
  -
  -    for (handp = handlers; handp->hr.content_type; ++handp) {
  -        if (handler_len == handp->len
  -            && !strncmp(handler, handp->hr.content_type, handler_len)) {
  -            result = (*handp->hr.handler) (r);
   
  -            if (result != DECLINED)
  -                return result;
  -        }
  -    }
  -
  -    /* Pass two --- wildcard matches */
  -
  -    for (handp = wildhandlers; handp->hr.content_type; ++handp) {
  -        if (handler_len >= handp->len
  -            && !strncmp(handler, handp->hr.content_type, handp->len)) {
  -            result = (*handp->hr.handler) (r);
  -
  -            if (result != DECLINED)
  -                return result;
  -         }
  -    }
  +    result=ap_run_handler(handler,r);
   
  -    if (result == HTTP_INTERNAL_SERVER_ERROR && r->handler && r->filename)
{
  +    if (result == DECLINED && r->handler && r->filename) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
               "handler \"%s\" not found for: %s", r->handler, r->filename);
       }
  -    return HTTP_INTERNAL_SERVER_ERROR;
  +    return result == DECLINED ? HTTP_INTERNAL_SERVER_ERROR : result;
   }
   
   AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method) {
  @@ -1712,7 +1634,6 @@
   AP_DECLARE(void) ap_post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp,
server_rec *s)
   {
       ap_run_post_config(pconf,plog,ptemp,s); 
  -    init_handlers(pconf);
   }
   
   void ap_child_init_hook(apr_pool_t *pchild, server_rec *s)
  
  
  
  1.129     +0 -1      httpd-2.0/server/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- mpmt_pthread.c	2000/12/19 20:44:23	1.128
  +++ mpmt_pthread.c	2001/01/07 19:55:58	1.129
  @@ -1407,7 +1407,6 @@
       NULL,			/* create per-server config structure */
       NULL,			/* merge per-server config structures */
       mpmt_pthread_cmds,		/* command apr_table_t */
  -    NULL,			/* handlers */
       mpmt_pthread_hooks		/* register_hooks */
   };
   
  
  
  
  1.140     +1 -3      httpd-2.0/server/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
  retrieving revision 1.139
  retrieving revision 1.140
  diff -u -r1.139 -r1.140
  --- prefork.c	2000/12/04 19:23:53	1.139
  +++ prefork.c	2001/01/07 19:55:59	1.140
  @@ -1543,7 +1543,6 @@
       static int restart_num = 0;
       int no_detach = 0;
   
  -    one_process = !!getenv("ONE_PROCESS");
       no_detach = !!getenv("NO_DETACH");
   
       /* sigh, want this only the second time around */
  @@ -1578,7 +1577,7 @@
   #ifdef AUX3
       (void) set42sig();
   #endif
  -    /* TODO: set one_process properly */ one_process = 0;
  +    one_process = !!getenv("ONE_PROCESS");
   
       ap_hook_pre_config(prefork_pre_config, NULL, NULL, AP_HOOK_MIDDLE);
   }
  @@ -1878,6 +1877,5 @@
       NULL,			/* create per-server config structure */
       NULL,			/* merge per-server config structures */
       prefork_cmds,		/* command apr_table_t */
  -    NULL,			/* handlers */
       prefork_hooks,		/* register hooks */
   };
  
  
  

Mime
View raw message