httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_config.c
Date Fri, 11 Aug 2000 23:41:55 GMT
coar        00/08/11 16:41:54

  Modified:    src/include http_config.h
               src/main http_config.c
  Log:
  	Preset the cmd_parms->limited field to the magic 'no limit active'
  	value, and add some prototype API routines for expanding support
  	for arbitrary extension HTTP methods.
  
  Revision  Changes    Path
  1.48      +16 -2     apache-2.0/src/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/http_config.h,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -u -r1.47 -r1.48
  --- http_config.h	2000/08/02 05:25:28	1.47
  +++ http_config.h	2000/08/11 23:41:51	1.48
  @@ -279,14 +279,14 @@
    * to carry a large variety of miscellaneous data which is all of
    * use to *somebody*...
    */
  -struct cmd_parms_struct
  -    {
  +struct cmd_parms_struct {
       /** Argument to command from cmd_table */
       void *info;
       /** Which allow-override bits are set */
       int override;
       /** Which methods are <Limit>ed */
       int limited;
  +    apr_array_header_t *limited_xmethods;
   
       /** Config file structure. */
       configfile_t *config_file;
  @@ -482,6 +482,20 @@
    */
   API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, void *,
   						   const char *);
  +
  +/**
  + * Return true if the specified method is limited by being listed in
  + * a <Limit> container, or by *not* being listed in a <LimiteExcept>
  + * container.
  + *
  + * @param   method  Pointer to a string specifying the method to check.
  + * @param   cmd     Pointer to the cmd_parms structure passed to the
  + *                  directive handler.
  + * @return  0 if the method is not limited in the current scope
  + * @deffunc ap_method_is_limited(cmd_parms *cmd, const char *method)
  + */
  +API_EXPORT(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
  +
   /**
    * Generic command handling function for strings, always sets the value
    * to a lowercase string
  
  
  
  1.74      +38 -9     apache-2.0/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -u -r1.73 -r1.74
  --- http_config.c	2000/08/04 23:22:57	1.73
  +++ http_config.c	2000/08/11 23:41:53	1.74
  @@ -378,6 +378,34 @@
       return HTTP_INTERNAL_SERVER_ERROR;
   }
   
  +API_EXPORT(int) ap_method_is_limited(cmd_parms *cmd, const char *method) {
  +    int methnum;
  +    int i;
  +    char **xmethod;
  +
  +    methnum = ap_method_number_of(method);
  +    /*
  +     * The simple case: a method hard-coded into Apache.
  +     */
  +    if (methnum != M_INVALID) {
  +	return (methnum & cmd->limited);
  +    }
  +    /*
  +     * Some extension method we don't know implicitly.
  +     */
  +    if ((cmd->limited_xmethods == NULL)
  +	|| (cmd->limited_xmethods->nelts == 0)) {
  +	return 0;
  +    }
  +    xmethod = (char **) cmd->limited_xmethods->elts;
  +    for (i = 0; i < cmd->limited_xmethods->nelts; ++i) {
  +	if (strcmp(method, xmethod[i]) == 0) {
  +	    return 1;
  +	}
  +    }
  +    return 0;
  +}
  +
   API_EXPORT(void) ap_register_hooks(module *m)
       {
       if(m->register_hooks)
  @@ -948,11 +976,11 @@
       return NULL;
   }
   
  -const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool,
  -					cmd_parms *parms,
  -					ap_directive_t **current,
  -					ap_directive_t **curr_parent,
  -                                        char *orig_directive)
  +const char *ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool,
  +				 cmd_parms *parms,
  +				 ap_directive_t **current,
  +				 ap_directive_t **curr_parent,
  +				 char *orig_directive)
   {
       char l[MAX_STRING_LEN];
       char *bracket;
  @@ -1300,8 +1328,9 @@
       fname = ap_server_root_relative(p, fname);
   
       /* don't require conf/httpd.conf if we have a -C or -c switch */
  -    if((ap_server_pre_read_config->nelts || ap_server_post_read_config->nelts) &&
  -       !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) {
  +    if ((ap_server_pre_read_config->nelts
  +	 || ap_server_post_read_config->nelts)
  +	&& !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) {
   	if (apr_stat(&finfo, fname, p) != APR_SUCCESS)     
   	    return;
       }
  @@ -1349,6 +1378,7 @@
       parms.temp_pool = ptemp;
       parms.server = s;
       parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
  +    parms.limited = -1;
   
       errmsg = ap_walk_config(conftree, &parms, s->lookup_defaults);
       if (errmsg) {
  @@ -1363,8 +1393,7 @@
   }
   
   int ap_parse_htaccess(void **result, request_rec *r, int override,
  -		   const char *d, const char *access_name)
  -{
  +		      const char *d, const char *access_name) {
       configfile_t *f = NULL;
       cmd_parms parms;
       char *filename = NULL;
  
  
  

Mime
View raw message