httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sameer <sam...@c2.net>
Subject Re: [PATCH] from uunet: mod_cern_meta update to 0.1.0
Date Fri, 22 Aug 1997 18:38:33 GMT
	When is the 1.3 feature freeze? If someone can let me know
when that is I'll be able to say if I can take point on this in time
for the freeze.

> [I received a bunch of patches from UUnet which they apply to every
> release.  I busted them apart into smaller pieces, but haven't tested any
> of them.  Consider this to be a +1 for inclusion in 1.3.  I'm hoping
> someone else will redo these as patches against 1.3.]
> 
> I always like per_directory configurable things.
> 
> Dean
> 
> Thu Aug 14 12:01:28 1997  David J. MacKenzie  <djm@va.pubnix.com>
> 
> 	* mod_cern_meta.c: Upgrade to current version from apache web site
> 	contrib directory.  Needed because it's configurable per-directory.
> 
> Index: src/mod_cern_meta.c
> --- mod_cern_meta.c	1997/07/08 21:08:30	1.1
> +++ mod_cern_meta.c	1997/07/08 21:22:46	1.2
> @@ -52,11 +52,18 @@
>  
>  /*
>   * mod_cern_meta.c
> - * version 0.0.5
> + * version 0.1.0
>   * status beta
>   * 
>   * Andrew Wilson <Andrew.Wilson@cm.cf.ac.uk> 25.Jan.96
>   *
> + * *** IMPORTANT ***
> + * This version of mod_cern_meta.c controls Meta File behaviour on a
> + * per-directory basis.  Previous versions of the module defined behaviour
> + * on a per-server basis.  The upshot is that you'll need to revisit your 
> + * configuration files in order to make use of the new module.
> + * ***
> + *
>   * Emulate the CERN HTTPD Meta file semantics.  Meta files are HTTP
>   * headers that can be output in addition to the normal range of
>   * headers for each file accessed.  They appear rather like the Apache
> @@ -67,8 +74,16 @@
>   * who can exploit this module.  It should be noted that there are probably
>   * more sensitive ways of managing the Expires: header specifically.
>   *
> - * The module obeys the following directives, which can only appear 
> - * in the server's .conf files and not in any .htaccess file.
> + * The module obeys the following directives, which can appear 
> + * in the server's .conf files and in .htaccess files.
> + *
> + *  MetaFiles <on|off> 
> + *
> + *    turns on|off meta file processing for any directory.  
> + *    Default value is off
> + *
> + *        # turn on MetaFiles in this directory
> + *        MetaFiles on
>   *
>   *  MetaDir <directory name>
>   *      
> @@ -122,7 +137,10 @@
>   *           need to report missing ones as spurious errors. 
>   * 31.Jan.96 log_error reports about a malformed .meta file, rather
>   *           than a script error.
> - *
> + * 20.Jun.96 MetaFiles <on|off> default off, added, so that module
> + *           can be configured per-directory.  Prior to this the module
> + *           was running for each request anywhere on the server, naughty..
> + * 29.Jun.96 All directives made per-directory.
>   */
>  
>  #include "httpd.h"
> @@ -133,51 +151,71 @@
>  #include "http_log.h"
>  #include "http_request.h"
>  
> +#define DIR_CMD_PERMS OR_INDEXES
> +
>  #define DEFAULT_METADIR		".web"
>  #define DEFAULT_METASUFFIX	".meta"
> +#define DEFAULT_METAFILES	0
>  
>  module cern_meta_module;
>  
>  typedef struct {
>  	char *metadir;
>  	char *metasuffix;
> -} cern_meta_config;
> +	char *metafiles;
> +} cern_meta_dir_config;
>  
> -void *create_cern_meta_config (pool *p, server_rec *dummy)
> +void *create_cern_meta_dir_config (pool *p, char *dummy)
>  {
> -    cern_meta_config *new =
> -      (cern_meta_config *) palloc (p, sizeof(cern_meta_config)); 
> - 
> -    new->metadir = DEFAULT_METADIR;
> -    new->metasuffix = DEFAULT_METASUFFIX;
> +    cern_meta_dir_config *new =
> +      (cern_meta_dir_config *) palloc (p, sizeof(cern_meta_dir_config));
> +
> +    new->metadir = NULL;
> +    new->metasuffix = NULL;
> +    new->metafiles = DEFAULT_METAFILES;
> +
> +    return new;
> +}
> +
> +void *merge_cern_meta_dir_configs (pool *p, void *basev, void *addv) 
> +{
> +    cern_meta_dir_config *base = (cern_meta_dir_config *)basev;
> +    cern_meta_dir_config *add = (cern_meta_dir_config *)addv; 
> +    cern_meta_dir_config *new =
> +      (cern_meta_dir_config *)palloc (p, sizeof(cern_meta_dir_config));
> +    
> +    new->metadir = add->metadir ? add->metadir : base->metadir;
> +    new->metasuffix = add->metasuffix ? add->metasuffix : base->metasuffix;
> +    new->metafiles = add->metafiles;
>      
>      return new;
>  }   
>  
> -const char *set_metadir (cmd_parms *parms, void *dummy, char *arg)
> -{       
> -    cern_meta_config *cmc ;
>  
> -    cmc = get_module_config (parms->server->module_config,
> -                           &cern_meta_module); 
> -    cmc->metadir = arg;
> +const char *set_metadir (cmd_parms *parms, cern_meta_dir_config *dconf, char *arg)
> +{       
> +    dconf->metadir = arg;
>      return NULL;
>  }
>  
> -const char *set_metasuffix (cmd_parms *parms, void *dummy, char *arg)
> +const char *set_metasuffix (cmd_parms *parms, cern_meta_dir_config *dconf, char *arg)
>  {       
> -    cern_meta_config *cmc ;
> +    dconf->metasuffix = arg;
> +    return NULL;
> +}
>  
> -    cmc = get_module_config (parms->server->module_config,
> -                           &cern_meta_module); 
> -    cmc->metasuffix = arg;
> +const char *set_metafiles (cmd_parms *parms, cern_meta_dir_config *dconf, char *arg)

> +{
> +    dconf->metafiles = arg;
>      return NULL;
>  }
>  
> +
>  command_rec cern_meta_cmds[] = {
> -{ "MetaDir", set_metadir, NULL, RSRC_CONF, TAKE1,
> +{ "MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, FLAG, NULL},
> +{ "MetaDir", set_metadir, NULL, DIR_CMD_PERMS, TAKE1,
>      "the name of the directory containing meta files"},
> -{ "MetaSuffix", set_metasuffix, NULL, RSRC_CONF, TAKE1,
> +{ "MetaSuffix", set_metasuffix, NULL, DIR_CMD_PERMS, TAKE1,
>      "the filename suffix for meta files"},
>  { NULL }
>  };  
> @@ -240,12 +278,15 @@
>      char *real_file;
>      char *scrap_book;
>      FILE *f;   
> -    cern_meta_config *cmc ;
> +    cern_meta_dir_config *dconf ;
>      int rv;
>      request_rec *rr;
>  
> -    cmc = get_module_config (r->server->module_config,
> -                           &cern_meta_module); 
> +    dconf = get_module_config (r->per_dir_config, &cern_meta_module); 
> +
> +    if (!dconf->metafiles) {
> +        return DECLINED;
> +    };
>  
>      /* if ./.web/$1.meta exists then output 'asis' */
>  
> @@ -275,7 +316,11 @@
>  	return DECLINED;
>      };
>  
> -    metafilename = pstrcat(r->pool, "/", scrap_book, "/", cmc->metadir, "/", real_file,
cmc->metasuffix, NULL);
> +    metafilename = pstrcat(r->pool, "/", scrap_book, "/", 
> +        dconf->metadir ? dconf->metadir : DEFAULT_METADIR, 
> +        "/", real_file, 
> +        dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX, 
> +        NULL);
>  
>      /* XXX: it sucks to require this subrequest to complete, because this
>       * means people must leave their meta files accessible to the world.
> @@ -308,9 +353,9 @@
>  module cern_meta_module = {
>     STANDARD_MODULE_STUFF,
>     NULL,			/* initializer */
> -   NULL,			/* dir config creater */
> -   NULL,			/* dir merger --- default is to override */
> -   create_cern_meta_config,	/* server config */
> +   create_cern_meta_dir_config,	/* dir config creater */
> +   merge_cern_meta_dir_configs,	/* dir merger --- default is to override */
> +   NULL,			/* server config */
>     NULL,			/* merge server configs */
>     cern_meta_cmds,		/* command table */
>     NULL,			/* handlers */
> 
> 


-- 
Sameer Parekh					Voice:   510-986-8770
President					FAX:     510-986-8777
C2Net
http://www.c2.net/				sameer@c2.net

Mime
View raw message