httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Let's get rid of .htaccess files :-)
Date Thu, 18 Jul 1996 04:12:02 GMT

Hmmm. I think I'm on to something here....

The following patch provides a very different version of the ConfigDir
functionality that I have presented in the past. While this probably
has some bugs and shortcomings at this stage, I think it would allow
us to ditch the use of .htaccess files completely.

By adding 'ConfigDir conf/db/' to your top level config file,
the server will recursively parse that directory tree looking
for (in the case of this patch) ".oO" files and parsing them
for config directives. By wrapping the contents of these files
with <Location ..> tags, we can preconfigure the entire server
setup at startup. It could even be possible to point the ConfigDir
directive at the DocumentRoot and allow it to parse the installed
.htaccess files.

What did I forget?

Index: src/http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.18
diff -c -r1.18 http_core.c
*** http_core.c	1996/06/12 18:14:31	1.18
--- http_core.c	1996/07/18 03:59:55
***************
*** 612,617 ****
--- 612,647 ----
      return errmsg;
  }
  
+ char *read_configdir (cmd_parms *cmd, void *dummy, char *dir)
+ {
+     char *ndir;
+     DIR *vdir;
+     struct DIR_TYPE *vdir_entry;
+     
+ 
+     dir = server_root_relative (cmd->pool, dir);
+     
+     if (!is_directory (dir))
+ 	fprintf (stderr, "ConfigDir must be a valid directory: %s", dir);
+     
+     if ((vdir = opendir (dir)) != NULL) {
+ 	while ((vdir_entry = readdir (vdir)) != NULL) {
+ 	    ndir = pstrcat (cmd->pool, dir, vdir_entry->d_name, NULL);
+ 	    if (is_directory (ndir)) {
+ 		if ((strcmp (vdir_entry->d_name, "..")) > 0) {
+ 		    ndir = pstrcat (cmd->pool, ndir, "/", NULL);
+ 		    read_configdir (cmd, dummy, ndir);
+ 		}
+ 	    }
+ 	    else if (!(strcmp(vdir_entry->d_name, ".oO")))
+ 		process_resource_config (cmd->server, ndir, cmd->pool, cmd->temp_pool);
+ 	}
+     }
+     
+     closedir (vdir);
+     return NULL;
+ }
+ 
  char *set_server_string_slot (cmd_parms *cmd, void *dummy, char *arg)
  {
      /* This one's pretty generic... */
***************
*** 849,854 ****
--- 879,885 ----
        "a port number or a numeric IP address and a port number"},
  { "<VirtualHost", virtualhost_section, NULL, RSRC_CONF, RAW_ARGS, NULL },
  { "</VirtualHost>", end_virtualhost_section, NULL, RSRC_CONF, NO_ARGS, NULL },
+ { "ConfigDir", read_configdir, NULL, RSRC_CONF, TAKE1, "directory containing config database"
},
  { NULL },
  };
  



Mime
View raw message