httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Wilson <and...@aaaaaaaa.demon.co.uk>
Subject mod_cern_meta.c - MetaFiles <on|off>
Date Thu, 20 Jun 1996 14:49:02 GMT
Hi,
	here'a quick fix to mod_cern_meta.c which adds a new directive

	MetaFiles <on|off>

which can appear in .conf or in .htaccess files.  Prior to this
fix the module would attempt to stat .meta files unnecessarily.
With the new directive in a .htaccess file you can limit the module's
operation to specific directories and subdirectories.

The default value for this directive is 'off'.

Note that existing users of mod_cern_meta will need to add the
directive:

	MetaFiles on

to their srm.conf or top-level .htaccess to recover the module's
previous (though essentially broken) behaviour.

Thanks to rst for essential provocation.

Ay.

--- cut here ---

*** mod_cern_meta.c.dist	Thu Jun 20 14:59:01 1996
--- mod_cern_meta.c	Thu Jun 20 15:33:56 1996
***************
*** 52,58 ****
  
  /*
   * mod_cern_meta.c
!  * version 0.0.5
   * status beta
   * 
   * Andrew Wilson <Andrew.Wilson@cm.cf.ac.uk> 25.Jan.96
--- 52,58 ----
  
  /*
   * mod_cern_meta.c
!  * version 0.0.6
   * status beta
   * 
   * Andrew Wilson <Andrew.Wilson@cm.cf.ac.uk> 25.Jan.96
***************
*** 70,75 ****
--- 70,83 ----
   * The module obeys the following directives, which can only appear 
   * in the server's .conf files and not in any .htaccess file.
   *
+  *  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>
   *      
   *    specifies the name of the directory in which Apache can find
***************
*** 122,128 ****
   *           need to report missing ones as spurious errors. 
   * 31.Jan.96 log_error reports about a malformed .meta file, rather
   *           than a script error.
!  *
   */
  
  #include "httpd.h"
--- 130,138 ----
   *           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.Jul.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..
   */
  
  #include "httpd.h"
***************
*** 132,145 ****
--- 142,159 ----
  #include "util_script.h"
  #include "http_log.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;
+ 	char *metafiles;
  } cern_meta_config;
  
  void *create_cern_meta_config (pool *p, server_rec *dummy)
***************
*** 149,154 ****
--- 163,169 ----
   
      new->metadir = DEFAULT_METADIR;
      new->metasuffix = DEFAULT_METASUFFIX;
+     new->metafiles = DEFAULT_METAFILES;
      
      return new;
  }   
***************
*** 173,179 ****
--- 188,206 ----
      return NULL;
  }
  
+ char *set_metafiles (cmd_parms *parms, void *dummy, char *arg) 
+ {
+     cern_meta_config *cmc ;
+ 
+     cmc = get_module_config (parms->server->module_config,
+                            &cern_meta_module); 
+     cmc->metafiles = arg;
+     return NULL;
+ }
+ 
+ 
  command_rec cern_meta_cmds[] = {
+ { "MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, FLAG, NULL},
  { "MetaDir", set_metadir, NULL, RSRC_CONF, TAKE1,
      "the name of the directory containing meta files"},
  { "MetaSuffix", set_metasuffix, NULL, RSRC_CONF, TAKE1,
***************
*** 245,250 ****
--- 272,281 ----
  
      cmc = get_module_config (r->server->module_config,
                             &cern_meta_module); 
+ 
+     if (!cmc->metafiles) {
+         return DECLINED;
+     };
  
      /* if ./.web/$1.meta exists then output 'asis' */
  

Mime
View raw message