You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/08/05 01:23:12 UTC

cvs commit: apache-2.0/src/main http_config.c

trawick     00/08/04 16:23:03

  Modified:    src      CHANGES
               src/main http_config.c
  Log:
  Fix a config tree problem.
  
  The following configuration file demonstrates the problem:
  
  <IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteMap    quux-map       prg:/tmp/apache-2.0/map.quux.pl
  RewriteRule   ^/~quux/(.*)$  /~quux/${quux-map:$1}
  </IfModule>
  
  After this config file is parsed, the only statement in the config
  tree is the last statement in the IfModule container ("RewriteRule blah
  blah").
  
  The problem is that when ap_build_config_sub() handles this type of
  construct, it moves *current to the end of the list before returning.
  If this construct were the first thing in the file, the caller would
  set conftree to *current, not realizing that there were list elements
  before *current.  The caller doesn't have addressability to those list
  elements.
  
  With this change, ap_build_config_sub() sets *conftree before
  walking *current to the end of the list.
  
  Revision  Changes    Path
  1.194     +6 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- CHANGES	2000/08/04 07:07:31	1.193
  +++ CHANGES	2000/08/04 23:22:55	1.194
  @@ -1,3 +1,9 @@
  +Changes with Apache 2.0a6
  +  *) A configuration file parsing problem was fixed.  When the 
  +     configuration file started with an IfModule/IfDefine container, 
  +     only the last statement in the container would be retained.  
  +     [Jeff Trawick]
  +
   Changes with Apache 2.0a5
     *) Perchild is serving pages after passing them to different child
        processes.  There are still a lot of bugs, but this does work.  I
  
  
  
  1.73      +10 -3     apache-2.0/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- http_config.c	2000/08/02 05:26:47	1.72
  +++ http_config.c	2000/08/04 23:22:57	1.73
  @@ -843,7 +843,8 @@
   static const char * ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
   					const char *l, cmd_parms *parms,
   					ap_directive_t **current,
  -					ap_directive_t **curr_parent)
  +					ap_directive_t **curr_parent,
  +                                        ap_directive_t **conftree)
   {
       const char *args;
       char *cmd_name;
  @@ -894,6 +895,12 @@
                   }
               }
               if (*current) {
  +                if (!*conftree) {
  +                    /* Before walking *current to the end of the list,
  +                     * set the head to *current.
  +                     */
  +                    *conftree = *current;
  +                }
                   while ((*current)->next != NULL) {
                       (*current) = (*current)->next;
                       (*current)->parent = (*curr_parent);
  @@ -959,7 +966,7 @@
               break;
           } 
           retval = ap_build_config_sub(p, temp_pool, l, parms, current, 
  -                                     curr_parent);
  +                                     curr_parent, &conftree);
           if (retval != NULL)
               return retval;
           if (conftree == NULL && curr_parent != NULL) { 
  @@ -1060,7 +1067,7 @@
       while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) {
   
   	errmsg = ap_build_config_sub(p, temp_pool, l, parms,
  -				     &current, &curr_parent);
  +				     &current, &curr_parent, conftree);
   	if (errmsg != NULL)
   	    return errmsg;