httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Per VirtualHost config files
Date Sat, 30 Mar 1996 22:23:47 GMT

I have the following patch that I would like to commit that
adds the ability to have separate config files for each 
virtual host. It uses a config file directive of VHostConfigDir.
It does still require that the <VirtualHost> tags be present
in the file.

Also mixed in is a tiny patch to mod_proxy.c that fixes a missing
defined constant on NetBSD. I chose MAXPATHLEN since I believe it
is most portable. I think most POSIX systems have PATH_MAX as
well that we could also use if MAXPATHLEN is a problem.


Index: src/http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.8
diff -c -r1.8 http_core.c
*** http_core.c	1996/03/30 07:16:40	1.8
--- http_core.c	1996/03/30 22:15:30
***************
*** 550,555 ****
--- 550,594 ----
      return errmsg;
  }
  
+ char *read_virtualhost_configdir (cmd_parms *cmd, void *dummy, char *arg)
+ {
+     DIR *vdir;
+     struct DIR_TYPE *vdir_entry;
+     char *dirname, *fname, *p;
+     
+     dirname = server_root_relative (cmd->pool, arg);
+     
+     fprintf (stderr, "arg: %s\n", dirname);
+     
+     if (!is_directory (dirname)) return "VHostConfigDir must be a valid directory";
+     
+     vdir = opendir (dirname);
+ 
+     if (vdir == NULL) {
+         return NULL;
+     }
+ 
+     if ((p = strrchr (dirname, '\0')))
+     {
+ 	if (*p-- != '/')
+ 	    dirname = pstrcat (cmd->pool, dirname, "/", NULL);
+     }
+     
+     while ((vdir_entry = readdir (vdir))) {
+ 
+ 	if ((strstr(vdir_entry->d_name, ".vconf")) != NULL)
+ 	{
+ 	    fname = pstrcat (cmd->pool, dirname, vdir_entry->d_name, NULL);
+ 	    process_resource_config (cmd->server, fname,
+ 				     cmd->pool, cmd->temp_pool);
+ 	}
+ 	else
+ 	    continue;
+     }
+ 
+     return NULL;
+ }
+ 
  char *set_server_string_slot (cmd_parms *cmd, void *dummy, char *arg)
  {
      /* This one's pretty generic... */
***************
*** 776,781 ****
--- 815,821 ----
        "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 },
+ { "VHostConfigDir", read_virtualhost_configdir, NULL, RSRC_CONF, TAKE1, "directory containing
virtualhost config files" },
  { NULL },
  };
  
Index: src/mod_proxy.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_proxy.c,v
retrieving revision 1.13
diff -c -r1.13 mod_proxy.c
*** mod_proxy.c	1996/03/30 18:19:47	1.13
--- mod_proxy.c	1996/03/30 22:16:27
***************
*** 1367,1373 ****
  			     const char *cachebasedir,const char *cachesubdir)
  {
      char line[27];
!     char cachedir[PATHSIZE];
      struct stat buf;
      int fd,i;
      DIR *dir;
--- 1367,1373 ----
  			     const char *cachebasedir,const char *cachesubdir)
  {
      char line[27];
!     char cachedir[MAXPATHLEN];
      struct stat buf;
      int fd,i;
      DIR *dir;
***************
*** 1425,1431 ****
  	}
  	if(S_ISDIR(buf.st_mode))
  	    {
! 	    char newcachedir[PATHSIZE];
  	    close(fd);
  	    sprintf(newcachedir,"%s%s/",cachesubdir,ent->d_name);
  	    if(!sub_garbage_coll(r,files,cachebasedir,newcachedir))
--- 1425,1431 ----
  	}
  	if(S_ISDIR(buf.st_mode))
  	    {
! 	    char newcachedir[MAXPATHLEN];
  	    close(fd);
  	    sprintf(newcachedir,"%s%s/",cachesubdir,ent->d_name);
  	    if(!sub_garbage_coll(r,files,cachebasedir,newcachedir))



Mime
View raw message