httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: patch? (Patch to fix the fatal missing VHost dir)
Date Wed, 29 May 1996 15:23:57 GMT

I'm including a patch to accomplish what Michael suggested.
Unfortunately, we cannot count on having an open error log
at this point, so we have to use fprintf() at present.
Error logging is a future project....

I am also including in this patch a genericized version of my
VHostConfigdir patch of old. This change allows you to specify
'ConfigDir' directives which are parsed for '*.conf' files.
I've elected to be specific about file extension so that it
would still be possible to have non-config files in these 
directories, as well as being about to turn off certain files
by renaming them.

*** http_core.c.orig	Wed May 29 10:18:41 1996
--- http_core.c	Wed May 29 10:18:35 1996
***************
*** 359,365 ****
      void *sconf = cmd->server->module_config;
      core_server_config *conf = get_module_config (sconf, &core_module);
    
!     if (!is_directory (arg)) return "DocumentRoot must be a directory";
      
      conf->document_root = arg;
      return NULL;
--- 359,369 ----
      void *sconf = cmd->server->module_config;
      core_server_config *conf = get_module_config (sconf, &core_module);
    
!     if (!is_directory (arg))
! 	if (cmd->server->is_virtual)
! 	    fprintf (stderr, "Warning: DocumentRoot [%s] does not exist", arg);
! 	else
! 	    return "DocumentRoot must be a directory";
      
      conf->document_root = arg;
      return NULL;
***************
*** 607,612 ****
--- 611,655 ----
      return errmsg;
  }
  
+ char *read_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);
+     
+     if (!is_directory (dirname))
+ 	log_error ("ConfigDir must be a valid directory", cmd->server);
+     
+     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, ".conf")) != NULL)
+ 	{
+ 	    fname = pstrcat (cmd->pool, dirname, vdir_entry->d_name, NULL);
+ 	    process_resource_config (cmd->server, fname,
+ 				     cmd->pool, cmd->temp_pool);
+ 	}
+ 	else
+ 	    continue;
+     }
+ 
+     closedir (vdir);
+     return NULL;
+ }
+ 
  char *set_server_string_slot (cmd_parms *cmd, void *dummy, char *arg)
  {
      /* This one's pretty generic... */
***************
*** 834,839 ****
--- 877,883 ----
        "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 files"
},
  { NULL },
  };
  




Mime
View raw message