httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: config files stuff
Date Thu, 17 Jul 1997 16:17:10 GMT
As long as we are considering an IncludeConfig directive, I would 
like to offer mine. This version can be given a file or directory. 
If given a directory, it recurses the directory tree looking for 
.htaccess. My use for it has been similar to Martijn's. I created 
it when tossing around the idea of having a parallel "registry" 
that could be given a perl script to edit access control for 
certain parts of the existing web space. Making Apache read the 
registry to get it's config and access control info.

Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.96
diff -c -r1.96 http_core.c
*** http_core.c	1997/07/16 00:41:21	1.96
--- http_core.c	1997/07/17 16:15:40
***************
*** 836,841 ****
--- 836,873 ----
      return errmsg;
  }
  
+ const char *include_config (cmd_parms *cmd, void *dummy, char *name)
+ {
+     char *nname;
+     DIR *vdir;
+     struct DIR_TYPE *vdir_entry;
+     core_server_config *conf;
+ 
+     
+     conf = get_module_config(cmd->server->module_config, &core_module);
+ 
+     name = server_root_relative(cmd->pool, name);
+     
+     if ((vdir = opendir(name)) != NULL) {
+ 	while ((vdir_entry = readdir(vdir)) != NULL) {
+ 	    if ((strcmp(vdir_entry->d_name, "..")) <= 0)
+ 		continue;
+ 
+ 	    nname = pstrcat(cmd->pool, name, vdir_entry->d_name, NULL);
+ 
+ 	    if (is_directory(nname))
+ 		nname = pstrcat(cmd->pool, nname, "/", NULL);
+ 
+ 	    include_config(cmd, dummy, nname);
+ 	}
+ 	closedir(vdir);
+     }
+     else if ((strstr(name, conf->access_name)) != NULL)
+ 	process_resource_config(cmd->server, name, cmd->pool, cmd->temp_pool);
+ 
+     return NULL;
+ }
+ 
  const char *add_module_command (cmd_parms *cmd, void *dummy, char *arg)
  {
      if (add_named_module (arg))
***************
*** 1314,1319 ****
--- 1346,1352 ----
  { "Listen", set_listener, NULL, RSRC_CONF, TAKE1,
        "a port number or a numeric IP address and a port number"},
  { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "send buffer size in bytes"},
+ { "IncludeConf", include_config, NULL, RSRC_CONF, RAW_ARGS, "configuration resource" },
  { "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE,
    "the name of a module" },
  { "ClearModuleList", clear_module_list_command, NULL, RSRC_CONF, NO_ARGS, NULL },





Mime
View raw message